XH 1.7: Add public XH_PageDataRouter::refresh()

A place to report and discuss bugs - please mention CMSimple-version, server, platform and browser version
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

XH 1.7: Add public XH_PageDataRouter::refresh()

Post by cmb » Tue Mar 24, 2015 12:42 pm

Hi everybody!

I just noticed that it's not possible to save changes made with Pagemanager from current trunk. The problem is, that XH_PageDataRouter::$model is protected since r1490, but Pagemanager calls $pd_router->model->refresh(). Unfortunately, there's no equivalent method available in XH_PageDataRouter, and passing modified page data page-wise would trigger saving of content.htm for each page.

As a quick fix (in the long run we have to consider to rework the whole page data stuff) I suggest to add a public method refresh() to XH_PageDataRouter which simply delegates to XH_PageDataModel::refresh().

Also note, that protecting XH_PageDataRouter::$model might have broken other extensions as well, even though I presume, that it's not used by other extensions.

Thoughs?
Last edited by cmb on Wed Mar 25, 2015 10:07 pm, edited 1 time in total.
Reason: changed Subject to clarify suggestion
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.7: Add public XH_PageDataRouter::refresh()

Post by cmb » Tue Mar 31, 2015 11:48 am

Hi everybody!

I propose this patch:

Code: Select all

Index: cmsimple/classes/PageDataRouter.php
===================================================================
--- cmsimple/classes/PageDataRouter.php	(revision 1529)
+++ cmsimple/classes/PageDataRouter.php	(working copy)
@@ -142,6 +142,18 @@
     }
 
     /**
+     * Replaces the existing page data.
+     *
+     * @param array $data The new page data.
+     *
+     * @return bool Whether the page data have been refreshed.
+     */
+    public function refresh(array $data = null)
+    {
+        return $this->model->refresh($data);
+    }
+
+    /**
      * Returns the page data of a single page.
      *
      * @param int $id The page index.
The patch doesn't fix Pagemanager, but I shall make a new version of Pagemanager available within the next weeks.
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.7: Add public XH_PageDataRouter::refresh()

Post by cmb » Tue Apr 21, 2015 6:51 pm

Done (r1542).
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: XH 1.7: Add public XH_PageDataRouter::refresh()

Post by cmb » Fri May 08, 2015 12:07 am

cmb wrote:The patch doesn't fix Pagemanager, but I shall make a new version of Pagemanager available within the next weeks.
Pagemanager_XH 3.0dev1 is now integrated into the trunk.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply