コード例 #1
0
 public function getNextId()
 {
     $lastId = $this->getLastId();
     if (strpos($lastId, $this->getPrefix()) === 0) {
         $lastId = substr($lastId, strlen($this->getPrefix()));
     }
     $lastId = str_pad((string) $lastId, $this->getPadLength(), $this->getPadChar(), STR_PAD_LEFT);
     $nextId = '';
     $bumpNextChar = true;
     $chars = $this->getAllowedChars();
     $lchars = strlen($chars);
     $lid = strlen($lastId) - 1;
     for ($i = $lid; $i >= 0; $i--) {
         $p = strpos($chars, $lastId[$i]);
         if (false === $p) {
             throw AO::exception('Mage_Eav', AO::helper('eav')->__('Invalid character encountered in increment ID: %s', $lastId));
         }
         if ($bumpNextChar) {
             $p++;
             $bumpNextChar = false;
         }
         if ($p === $lchars) {
             $p = 0;
             $bumpNextChar = true;
         }
         $nextId = $chars[$p] . $nextId;
     }
     return $this->format($nextId);
 }
コード例 #2
0
ファイル: Extension.php プロジェクト: ronseigel/agent-ohm
 public function generatePackageXml()
 {
     AO::getSingleton('adminhtml/session')->setLocalExtensionPackageFormData($this->getData());
     Varien_Pear::$reloadOnRegistryUpdate = false;
     $pkg = new Varien_Pear_Package();
     #$pkg->getPear()->runHtmlConsole(array('command'=>'list-channels'));
     $pfm = $pkg->getPfm();
     $pfm->setOptions(array('packagedirectory' => '.', 'baseinstalldir' => '.', 'simpleoutput' => true));
     $this->_setPackage($pfm);
     $this->_setRelease($pfm);
     $this->_setMaintainers($pfm);
     $this->_setDependencies($pfm);
     $this->_setContents($pfm);
     #echo "<pre>".print_r($pfm,1)."</pre>";
     if (!$pfm->validate(PEAR_VALIDATE_NORMAL)) {
         //echo "<pre>".print_r($this->getData(),1)."</pre>";
         //echo "TEST:";
         //echo "<pre>".print_r($pfm->getValidationWarnings(), 1)."</pre>";
         $message = $pfm->getValidationWarnings();
         //$message = $message[0]['message'];
         throw AO::exception('Mage_Adminhtml', AO::helper('adminhtml')->__($message[0]['message']));
         return $this;
     }
     $this->setPackageXml($pfm->getDefaultGenerator()->toXml(PEAR_VALIDATE_NORMAL));
     return $this;
 }
コード例 #3
0
 public function getDir($type)
 {
     $method = 'get' . ucwords($type) . 'Dir';
     $dir = $this->{$method}();
     if (!$dir) {
         throw AO::exception('Mage_Core', 'Invalid dir type requested: ' . $type);
     }
     return $dir;
 }
コード例 #4
0
ファイル: Flush.php プロジェクト: ronseigel/agent-ohm
 protected function _toHtml()
 {
     if (!$this->_beforeToHtml()) {
         return '';
     }
     ob_implicit_flush();
     foreach ($this->getSortedChildren() as $name) {
         $block = $this->getLayout()->getBlock($name);
         if (!$block) {
             AO::exception(AO::helper('core')->__('Invalid block: %s', $name));
         }
         echo $block->toHtml();
     }
 }
コード例 #5
0
 public function getCode($type, $code = '')
 {
     $codes = array('condition_name' => array('package_weight' => AO::helper('shipping')->__('Weight vs. Destination'), 'package_value' => AO::helper('shipping')->__('Price vs. Destination'), 'package_qty' => AO::helper('shipping')->__('# of Items vs. Destination')), 'condition_name_short' => array('package_weight' => AO::helper('shipping')->__('Weight (and above)'), 'package_value' => AO::helper('shipping')->__('Order Subtotal (and above)'), 'package_qty' => AO::helper('shipping')->__('# of Items (and above)')));
     if (!isset($codes[$type])) {
         throw AO::exception('Mage_Shipping', AO::helper('shipping')->__('Invalid Table Rate code type: %s', $type));
     }
     if ('' === $code) {
         return $codes[$type];
     }
     if (!isset($codes[$type][$code])) {
         throw AO::exception('Mage_Shipping', AO::helper('shipping')->__('Invalid Table Rate code for type %s: %s', $type, $code));
     }
     return $codes[$type][$code];
 }
コード例 #6
0
 public function getChildHtmlList()
 {
     if (is_null($this->_list)) {
         $this->_list = array();
         foreach ($this->getSortedChildren() as $name) {
             $block = $this->getLayout()->getBlock($name);
             if (!$block) {
                 AO::exception(AO::helper('catalog')->__('Invalid block: %s', $name));
             }
             $this->_list[] = $block->toHtml();
         }
     }
     return $this->_list;
 }
コード例 #7
0
ファイル: Config.php プロジェクト: ronseigel/agent-ohm
 protected function _getCarrier($code, $config, $store = null)
 {
     /*
             if (isset(self::$_carriers[$code])) {
                 return self::$_carriers[$code];
             }
     */
     if (!isset($config['model'])) {
         throw AO::exception('Mage_Shipping', 'Invalid model for shipping method: ' . $code);
     }
     $modelName = $config['model'];
     $carrier = AO::getModel($modelName);
     $carrier->setId($code)->setStore($store);
     self::$_carriers[$code] = $carrier;
     return self::$_carriers[$code];
 }
コード例 #8
0
 /**
  * Retrieve all options for the source from configuration
  *
  * @return array
  */
 public function getAllOptions()
 {
     if (is_null($this->_options)) {
         $this->_options = array();
         if ($this->_configNodePath) {
             $rootNode = AO::getConfig()->getNode($this->_configNodePath);
         }
         if (!$rootNode) {
             throw AO::exception('Mage_Eav', AO::helper('eav')->__('Failed to load node %s from config.', $this->_configNodePath));
         }
         $options = $rootNode->children();
         if (empty($options)) {
             throw AO::exception('Mage_Eav', AO::helper('eav')->__('No options found in config node %s', $this->_configNodePath));
         }
         foreach ($options as $option) {
             $this->_options[] = array('value' => (string) $option->value, 'label' => (string) $option->label);
         }
     }
     return $this->_options;
 }
コード例 #9
0
ファイル: Currency.php プロジェクト: ronseigel/agent-ohm
 /**
  * Get currency rate
  *
  * @param   string $toCurrency
  * @return  double
  */
 public function getRate($toCurrency)
 {
     if (is_string($toCurrency)) {
         $code = $toCurrency;
     } elseif ($toCurrency instanceof Mage_Directory_Model_Currency) {
         $code = $toCurrency->getCurrencyCode();
     } else {
         throw AO::exception('Mage_Directory', AO::helper('directory')->__('Invalid target currency'));
     }
     $rates = $this->getRates();
     if (!isset($rates[$code])) {
         $rates[$code] = $this->_getResource()->getRate($this->getCode(), $toCurrency);
         $this->setRates($rates);
     }
     return $rates[$code];
 }
コード例 #10
0
 /**
  * Prepare entity object data for save
  *
  * result array structure:
  * array (
  *  'newObject', 'entityRow', 'insert', 'update', 'delete'
  * )
  *
  * @param   Varien_Object $newObject
  * @return  array
  */
 protected function _collectSaveData($newObject)
 {
     $newData = $newObject->getData();
     $entityId = $newObject->getData($this->getEntityIdField());
     if (!empty($entityId)) {
         /**
          * get current data in db for this entity
          */
         /*$className  = get_class($newObject);
           $origObject = new $className();
           $origObject->setData(array());
           $this->load($origObject, $entityId);
           $origData = $origObject->getOrigData();*/
         $origData = $this->_getOrigObject($newObject)->getOrigData();
         /**
          * drop attributes that are unknown in new data
          * not needed after introduction of partial entity loading
          */
         foreach ($origData as $k => $v) {
             if (!array_key_exists($k, $newData)) {
                 unset($origData[$k]);
             }
         }
     }
     foreach ($newData as $k => $v) {
         /**
          * Check attribute information
          */
         if (is_numeric($k) || is_array($v)) {
             continue;
             throw AO::exception('Mage_Eav', AO::helper('eav')->__('Invalid data object key'));
         }
         $attribute = $this->getAttribute($k);
         if (empty($attribute)) {
             continue;
         }
         $attrId = $attribute->getAttributeId();
         /**
          * if attribute is static add to entity row and continue
          */
         if ($this->isAttributeStatic($k)) {
             $entityRow[$k] = $this->_prepareStaticValue($k, $v);
             continue;
         }
         /**
          * Check comparability for attribute value
          */
         if (isset($origData[$k])) {
             if ($attribute->isValueEmpty($v)) {
                 $delete[$attribute->getBackend()->getTable()][] = array('attribute_id' => $attrId, 'value_id' => $attribute->getBackend()->getValueId());
             } elseif ($v !== $origData[$k]) {
                 $update[$attrId] = array('value_id' => $attribute->getBackend()->getValueId(), 'value' => $v);
             }
         } elseif (!$attribute->isValueEmpty($v)) {
             $insert[$attrId] = $v;
         }
     }
     $result = compact('newObject', 'entityRow', 'insert', 'update', 'delete');
     return $result;
 }
コード例 #11
0
 /**
  * Add attribute value table to the join if it wasn't added previously
  *
  * @param   string $attributeCode
  * @param   string $joinType inner|left
  * @return  Mage_Eav_Model_Entity_Collection_Abstract
  */
 protected function _addAttributeJoin($attributeCode, $joinType = 'inner')
 {
     if (!empty($this->_filterAttributes[$attributeCode])) {
         return $this;
     }
     $attrTable = $this->_getAttributeTableAlias($attributeCode);
     if (isset($this->_joinAttributes[$attributeCode])) {
         $attribute = $this->_joinAttributes[$attributeCode]['attribute'];
         $entity = $attribute->getEntity();
         $entityIdField = $entity->getEntityIdField();
         $fkName = $this->_joinAttributes[$attributeCode]['bind'];
         $fkAttribute = $this->_joinAttributes[$attributeCode]['bindAttribute'];
         $fkTable = $this->_getAttributeTableAlias($fkName);
         if ($fkAttribute->getBackend()->isStatic()) {
             if (isset($this->_joinAttributes[$fkName])) {
                 $fk = $fkTable . "." . $fkAttribute->getAttributeCode();
             } else {
                 $fk = "e." . $fkAttribute->getAttributeCode();
             }
         } else {
             $this->_addAttributeJoin($fkAttribute->getAttributeCode(), $joinType);
             $fk = "{$fkTable}.value";
         }
         $pk = $attrTable . '.' . $this->_joinAttributes[$attributeCode]['filter'];
     } else {
         $entity = $this->getEntity();
         $entityIdField = $entity->getEntityIdField();
         $attribute = $entity->getAttribute($attributeCode);
         $fk = "e.{$entityIdField}";
         $pk = "{$attrTable}.{$entityIdField}";
     }
     if (!$attribute) {
         throw AO::exception('Mage_Eav', AO::helper('eav')->__('Invalid attribute name: %s', $attributeCode));
     }
     if ($attribute->getBackend()->isStatic()) {
         $attrFieldName = "{$attrTable}." . $attribute->getAttributeCode();
     } else {
         $attrFieldName = "{$attrTable}.value";
     }
     $condArr = array("{$pk} = {$fk}");
     if (!$attribute->getBackend()->isStatic()) {
         $condArr[] = $this->getConnection()->quoteInto("{$attrTable}.attribute_id=?", $attribute->getId());
     }
     /**
      * process join type
      */
     $joinMethod = $joinType == 'left' ? 'joinLeft' : 'join';
     $this->_joinAttributeToSelect($joinMethod, $attribute, $attrTable, $condArr, $attributeCode, $attrFieldName);
     $this->removeAttributeToSelect($attributeCode);
     $this->_filterAttributes[$attributeCode] = $attribute->getId();
     /**
      * Fix double join for using same as filter
      */
     $this->_joinFields[$attributeCode] = array('table' => '', 'field' => $attrFieldName);
     return $this;
 }
コード例 #12
0
 /**
  * Retrieve backend instance
  *
  * @return Mage_Eav_Model_Entity_Attribute_Backend_Abstract
  */
 public function getBackend()
 {
     if (empty($this->_backend)) {
         if (!$this->getBackendModel()) {
             $this->setBackendModel($this->_getDefaultBackendModel());
         }
         $backend = AO::getModel($this->getBackendModel());
         if (!$backend) {
             throw AO::exception('Mage_Eav', 'Invalid backend model specified: ' . $this->getBackendModel());
         }
         $this->_backend = $backend->setAttribute($this);
     }
     return $this->_backend;
 }
コード例 #13
0
ファイル: Standard.php プロジェクト: ronseigel/agent-ohm
 /**
  * Including controller class if checking of existense class before include
  *
  * @param string $controllerFileName
  * @param string $controllerClassName
  * @return bool
  */
 protected function _inludeControllerClass($controllerFileName, $controllerClassName)
 {
     if (!class_exists($controllerClassName, false)) {
         if (!file_exists($controllerFileName)) {
             return false;
         }
         include $controllerFileName;
         if (!class_exists($controllerClassName, false)) {
             throw AO::exception('Mage_Core', AO::helper('core')->__('Controller file was loaded but class does not exist'));
         }
     }
     return true;
 }
コード例 #14
0
ファイル: App.php プロジェクト: ronseigel/agent-ohm
 /**
  * Retrieve application store group object
  *
  * @return Mage_Core_Model_Store_Group
  */
 public function getGroup($id = null)
 {
     if (is_null($id)) {
         $id = $this->getStore()->getGroup()->getId();
     } elseif ($id instanceof Mage_Core_Model_Store_Group) {
         return $id;
     }
     if (empty($this->_groups[$id])) {
         $group = AO::getModel('core/store_group');
         if (is_numeric($id)) {
             $group->load($id);
             if (!$group->hasGroupId()) {
                 throw AO::exception('Mage_Core', 'Invalid store group id requested.');
             }
         }
         $this->_groups[$group->getGroupId()] = $group;
     }
     return $this->_groups[$id];
 }
コード例 #15
0
ファイル: Layout_Update.php プロジェクト: ronseigel/agent-ohm
 /**
  * Load layout updates by handles
  *
  * @param array|string $handles
  * @return Mage_Core_Model_Layout_Update
  */
 public function load($handles = array())
 {
     if (is_string($handles)) {
         $handles = array($handles);
     } elseif (!is_array($handles)) {
         throw AO::exception('Mage_Core', AO::helper('core')->__('Invalid layout update handle'));
     }
     foreach ($handles as $handle) {
         $this->addHandle($handle);
     }
     if ($this->loadCache()) {
         return $this;
     }
     foreach ($this->getHandles() as $handle) {
         $this->merge($handle);
     }
     $this->saveCache();
     return $this;
 }
コード例 #16
0
ファイル: Schedule.php プロジェクト: ronseigel/agent-ohm
 public function matchCronExpression($expr, $num)
 {
     // handle ALL match
     if ($expr === '*') {
         return true;
     }
     // handle multiple options
     if (strpos($expr, ',') !== false) {
         foreach (explode(',', $expr) as $e) {
             if ($this->matchCronExpression($e, $num)) {
                 return true;
             }
         }
         return false;
     }
     // handle modulus
     if (strpos($expr, '/') !== false) {
         $e = explode('/', $expr);
         if (sizeof($e) !== 2) {
             throw AO::exception('Mage_Cron', "Invalid cron expression, expecting 'match/modulus': " . $expr);
         }
         if (!is_numeric($e[1])) {
             throw AO::exception('Mage_Cron', "Invalid cron expression, expecting numeric modulus: " . $expr);
         }
         $expr = $e[0];
         $mod = $e[1];
     } else {
         $mod = 1;
     }
     // handle all match by modulus
     if ($expr === '*') {
         $from = 0;
         $to = 60;
     } elseif (strpos($expr, '-') !== false) {
         $e = explode('-', $expr);
         if (sizeof($e) !== 2) {
             throw AO::exception('Mage_Cron', "Invalid cron expression, expecting 'from-to' structure: " . $expr);
         }
         $from = $this->getNumeric($e[0]);
         $to = $this->getNumeric($e[1]);
     } else {
         $from = $this->getNumeric($expr);
         $to = $from;
     }
     if ($from === false || $to === false) {
         throw AO::exception('Mage_Cron', "Invalid cron expression: " . $expr);
     }
     return $num >= $from && $num <= $to && $num % $mod === 0;
 }
コード例 #17
0
ファイル: Backup.php プロジェクト: ronseigel/agent-ohm
 /**
  * Write to backup file
  *
  * @param string $string
  * @return Mage_Backup_Model_Backup
  */
 public function write($string)
 {
     if (is_null($this->_handler)) {
         AO::exception('Mage_Backup', AO::helper('backup')->__('Backup file handler don\'t specify'));
     }
     try {
         gzwrite($this->_handler, $string);
     } catch (Exception $e) {
         AO::exception('Mage_Backup', AO::helper('backup')->__('Error write to Backup file "%s"', $this->getFileName()));
     }
     return $this;
 }
コード例 #18
0
ファイル: Store.php プロジェクト: ronseigel/agent-ohm
 public function getBaseUrl($type = self::URL_TYPE_LINK, $secure = null)
 {
     $cacheKey = $type . '/' . (is_null($secure) ? 'null' : ($secure ? 'true' : 'false'));
     if (!isset($this->_baseUrlCache[$cacheKey])) {
         switch ($type) {
             case self::URL_TYPE_WEB:
                 $secure = is_null($secure) ? $this->isCurrentlySecure() : (bool) $secure;
                 $url = $this->getConfig('web/' . ($secure ? 'secure' : 'unsecure') . '/base_url');
                 break;
             case self::URL_TYPE_LINK:
                 $secure = (bool) $secure;
                 $url = $this->getConfig('web/' . ($secure ? 'secure' : 'unsecure') . '/base_link_url');
                 $url = $this->_updatePathUseRewrites($url);
                 $url = $this->_updatePathUseStoreView($url);
                 break;
             case self::URL_TYPE_SKIN:
             case self::URL_TYPE_MEDIA:
             case self::URL_TYPE_JS:
                 $secure = is_null($secure) ? $this->isCurrentlySecure() : (bool) $secure;
                 $url = $this->getConfig('web/' . ($secure ? 'secure' : 'unsecure') . '/base_' . $type . '_url');
                 break;
             default:
                 throw AO::exception('Mage_Core', AO::helper('core')->__('Invalid base url type'));
         }
         $this->_baseUrlCache[$cacheKey] = rtrim($url, '/') . '/';
     }
     #echo "CACHE: ".$cacheKey.','.$this->_baseUrlCache[$cacheKey].' *** ';
     return $this->_baseUrlCache[$cacheKey];
 }
コード例 #19
0
 /**
  * Send transactional email to recipient
  *
  * @param   int $templateId
  * @param   string|array $sender sneder informatio, can be declared as part of config path
  * @param   string $email recipient email
  * @param   string $name recipient name
  * @param   array $vars varianles which can be used in template
  * @param   int|null $storeId
  * @return  Mage_Core_Model_Email_Template
  */
 public function sendTransactional($templateId, $sender, $email, $name, $vars = array(), $storeId = null)
 {
     $this->setSentSuccess(false);
     if ($storeId === null && $this->getDesignConfig()->getStore()) {
         $storeId = $this->getDesignConfig()->getStore();
     }
     if (is_numeric($templateId)) {
         $this->load($templateId);
     } else {
         $localeCode = AO::getStoreConfig('general/locale/code', $storeId);
         $this->loadDefault($templateId, $localeCode);
     }
     if (!$this->getId()) {
         throw AO::exception('Mage_Core', AO::helper('core')->__('Invalid transactional email code: ' . $templateId));
     }
     if (!is_array($sender)) {
         $this->setSenderName(AO::getStoreConfig('trans_email/ident_' . $sender . '/name', $storeId));
         $this->setSenderEmail(AO::getStoreConfig('trans_email/ident_' . $sender . '/email', $storeId));
     } else {
         $this->setSenderName($sender['name']);
         $this->setSenderEmail($sender['email']);
     }
     $this->setSentSuccess($this->send($email, $name, $vars));
     return $this;
 }
コード例 #20
0
 /**
  * Declare design package theme params
  *
  * @return Mage_Core_Model_Design_Package
  */
 public function setTheme()
 {
     switch (func_num_args()) {
         case 1:
             foreach (array('layout', 'template', 'skin', 'locale') as $type) {
                 $this->_theme[$type] = func_get_arg(0);
             }
             break;
         case 2:
             $this->_theme[func_get_arg(0)] = func_get_arg(1);
             break;
         default:
             throw AO::exception(AO::helper('core')->__('Wrong number of arguments for %s', __METHOD__));
     }
     return $this;
 }
コード例 #21
0
ファイル: Entity_Setup.php プロジェクト: ronseigel/agent-ohm
 /**
  * Retrieve Attribute Group Id by Id or Name
  *
  * @param mixed $entityTypeId
  * @param mixed $setId
  * @param mixed $groupId
  * @return Mage_Eav_Model_Entity_Setup
  */
 public function getAttributeGroupId($entityTypeId, $setId, $groupId)
 {
     if (!is_numeric($groupId)) {
         $groupId = $this->getAttributeGroup($entityTypeId, $setId, $groupId, 'attribute_group_id');
     }
     if (!is_numeric($groupId)) {
         throw AO::exception('Mage_Eav', AO::helper('eav')->__('Wrong attribute group ID'));
     }
     return $groupId;
 }
コード例 #22
0
 /**
  * Run module modification sql
  *
  * @param     string $actionType install|upgrade|uninstall
  * @param     string $fromVersion
  * @param     string $toVersion
  * @return    bool
  */
 protected function _modifyResourceDb($actionType, $fromVersion, $toVersion)
 {
     $resModel = (string) $this->_connectionConfig->model;
     $modName = (string) $this->_moduleConfig[0]->getName();
     $sqlFilesDir = AO::getModuleDir('sql', $modName) . DS . $this->_resourceName;
     if (!is_dir($sqlFilesDir) || !is_readable($sqlFilesDir)) {
         AO::getResourceModel('core/resource')->setDbVersion($this->_resourceName, $toVersion);
         return $toVersion;
     }
     // Read resource files
     $arrAvailableFiles = array();
     $sqlDir = dir($sqlFilesDir);
     while (false !== ($sqlFile = $sqlDir->read())) {
         $matches = array();
         if (preg_match('#^' . $resModel . '-' . $actionType . '-(.*)\\.(sql|php)$#i', $sqlFile, $matches)) {
             $arrAvailableFiles[$matches[1]] = $sqlFile;
         }
     }
     $sqlDir->close();
     if (empty($arrAvailableFiles)) {
         AO::getResourceModel('core/resource')->setDbVersion($this->_resourceName, $toVersion);
         return $toVersion;
     }
     // Get SQL files name
     $arrModifyFiles = $this->_getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrAvailableFiles);
     if (empty($arrModifyFiles)) {
         AO::getResourceModel('core/resource')->setDbVersion($this->_resourceName, $toVersion);
         return $toVersion;
     }
     $modifyVersion = null;
     foreach ($arrModifyFiles as $resourceFile) {
         $sqlFile = $sqlFilesDir . DS . $resourceFile['fileName'];
         $fileType = pathinfo($resourceFile['fileName'], PATHINFO_EXTENSION);
         // Execute SQL
         if ($this->_conn) {
             try {
                 switch ($fileType) {
                     case 'sql':
                         $sql = file_get_contents($sqlFile);
                         if ($sql != '') {
                             $result = $this->run($sql);
                         } else {
                             $result = true;
                         }
                         break;
                     case 'php':
                         $conn = $this->_conn;
                         /**
                          * useful variables:
                          * - $conn: setup db connection
                          * - $sqlFilesDir: root dir for sql update files
                          */
                         try {
                             #$conn->beginTransaction();
                             $result = (include $sqlFile);
                             #$conn->commit();
                         } catch (Exception $e) {
                             #$conn->rollback();
                             throw $e;
                         }
                         break;
                     default:
                         $result = false;
                 }
                 if ($result) {
                     /*$this->run("replace into ".$this->getTable('core/resource')." (code, version) values ('".$this->_resourceName."', '".$resourceFile['toVersion']."')");*/
                     AO::getResourceModel('core/resource')->setDbVersion($this->_resourceName, $resourceFile['toVersion']);
                 }
             } catch (Exception $e) {
                 echo "<pre>" . print_r($e, 1) . "</pre>";
                 throw AO::exception('Mage_Core', AO::helper('core')->__('Error in file: "%s" - %s', $sqlFile, $e->getMessage()));
             }
         }
         $modifyVersion = $resourceFile['toVersion'];
     }
     if ($actionType == 'upgrade' && $modifyVersion != $toVersion) {
         AO::getResourceModel('core/resource')->setDbVersion($this->_resourceName, $toVersion);
     } else {
         $toVersion = $modifyVersion;
     }
     self::$_hadUpdates = true;
     return $toVersion;
 }