Ejemplo n.º 1
0
 /**
  * Recursively duplicate components
  *
  * You need to call afterDuplicate afterwards!
  */
 public static function duplicate(Kwf_Component_Data $source, Kwf_Component_Data $parentTarget, Zend_ProgressBar $progressBar = null)
 {
     $new = $source->generator->duplicateChild($source, $parentTarget, $progressBar);
     if (!$new) {
         throw new Kwf_Exception("Failed duplicating '{$source->componentId}'");
     }
     Kwf_Component_Generator_Abstract::clearInstances();
     Kwf_Component_Data_Root::reset();
     //TODO: schöner wär ein flag bei den komponenten ob es diese fkt im admin
     //gibt und dann für alle admins aufrufen
     //ändern sobald es für mehrere benötigt wird
     Kwc_Root_TrlRoot_Chained_Admin::duplicated($source, $new);
     return $new;
 }
Ejemplo n.º 2
0
 protected function _afterSave()
 {
     parent::_afterSave();
     Kwf_Component_Data_Root::reset();
     Kwf_Component_Generator_Abstract::clearInstances();
 }
Ejemplo n.º 3
0
 private function _executeUpdatesAction($method)
 {
     $ret = true;
     foreach ($this->_updates as $update) {
         Kwf_Model_Abstract::clearInstances();
         //wegen eventueller meta-data-caches die sich geändert haben
         Kwf_Component_Generator_Abstract::clearInstances();
         Kwf_Component_Data_Root::reset();
         if ($this->_progressBar && $method == 'update') {
             $this->_progressBar->next(1, $update->getUniqueName());
         }
         $e = false;
         try {
             if (!$this->_verbose) {
                 ob_start();
                 //update script should not output anything, if it still does discard it
             }
             $update->{$method}();
             if (!$this->_verbose) {
                 ob_end_clean();
             }
         } catch (Exception $e) {
             if (!$this->_verbose) {
                 ob_end_clean();
             }
             if ($this->_debug) {
                 throw $e;
             }
             $this->_errors[] = array('name' => $update->getUniqueName(), 'message' => $e->getMessage());
             if ($this->_verbose) {
                 echo "\nError:\n";
                 echo $e->getMessage() . "\n\n";
                 flush();
             }
             $ret = false;
         }
     }
     return $ret;
 }
Ejemplo n.º 4
0
 /**
  * @internal
  */
 public static function reset($resetCache = true)
 {
     self::$_instance = null;
     Kwf_Component_Generator_Abstract::clearInstances();
     Kwf_Component_Abstract::clearModelInstances();
     Kwf_Events_Dispatcher::clearCache();
     if ($resetCache) {
         Kwf_Component_Abstract::resetSettingsCache();
     }
 }