Detecting page moves within same parent

Permalink
The on_page_move event works nicely, but it only fires when you move a page to a new parent. If you simply change its display order within the same parent then nothing is fired.

I'm trying to think of a way to detect this without overwriting any core files and the only thing I have so far is to watch certain tables in the database:

$db = Loader::db();
$v = array('Pages', 'Collections', 'CollectionVersions');
$q = "SHOW TABLE STATUS WHERE Name in(?, ?, ?)";
$arrResults = $db->query($q, $v);
foreach($arrResults as $arrResult){
   // If the last modified date is more recent than a timestamp
   if(strtotime($arrResult['Update_time']) > $timestamp ){                        
      // code here
   }
}


AFAIK, Collections and CollectionVersions will update whenever pages are added/deleted/have their attributes changed and Pages will detect any display order changes (both inter and intra-parent).

It seems like this method will catch any change to any page so even if you sneeze near a collection/page it should catch it.

Problem #1
Pages also updates whenever a page is checked out/goes into edit mode and again when it is checked back in. Even if you don't edit the page, the table will update because its checked in/out status will have changed.

Problem #2
I'm relying on the table names never changing and although these particular tables probably won't for some time (could be completely wrong on this) I'm not comfortable with hard-coding them.

Is there a simpler way to catch this that I've completely overlooked?

Cheers :D

beebs93
 
Mnkras replied on at Permalink Reply
Mnkras
Could you please add this to the bugs section.
beebs93 replied on at Permalink Reply
beebs93
Done.