예제 #1
0
 /**
  * Restore backupped videos 
  * This is not a trigger of plugin API. It's called by Backupper plugin
  */
 function restoreItems($items)
 {
     $models = Application_Model_BookmarksMapper::i()->fetchAll();
     // cleaning up all shares
     foreach ($models as $model) {
         Application_Model_BookmarksMapper::i()->delete($model);
     }
     foreach (@$items['pages'] as $modelInfo) {
         $model = new Application_Model_Bookmark();
         $model->setOptions($modelInfo);
         $model->setId(false);
         // i don't set id, or db adapter will try to update old data that i cleaned
         Application_Model_BookmarksMapper::i()->save($model);
     }
     return X_Env::_('p_bookmarks_backupper_restoreditems', count($items['pages']));
 }