當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Package::upgrade方法代碼示例

本文整理匯總了PHP中Package::upgrade方法的典型用法代碼示例。如果您正苦於以下問題:PHP Package::upgrade方法的具體用法?PHP Package::upgrade怎麽用?PHP Package::upgrade使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Package的用法示例。


在下文中一共展示了Package::upgrade方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: upgrade

 public function upgrade()
 {
     parent::upgrade();
     $pkg = Package::getByHandle($this->pkgHandle);
     //@todo write conversion from lang to locale
     //1.0 - 1.1 changed languaage to locale
     $db = Loader::db();
     // update the MultilingualSections table
     $rows = $db->getAll("SELECT * FROM MultilingualSections");
     if (is_array($rows) && count($rows)) {
         foreach ($rows as $r) {
             if (strlen($r['msLanguage']) && !strlen($r['msLocale'])) {
                 $locale = $r['msLanguage'] . (strlen($r['msIcon']) ? "_" . $r['msIcon'] : "");
                 $db->query("UPDATE MultilingualSections SET msLocale = ? WHERE cID = ?", array($locale, $r['cID']));
             }
         }
     }
     // install job
     Loader::model('job');
     $jb = Job::installByPackage('generate_multilingual_sitemap', $pkg);
     // update the MultilingualPageRelations table
     $hasLocales = $db->getOne("SELECT COUNT(msLocale) FROM MultilingualSections WHERE LENGTH(msLocale)");
     if (!$hasLocales) {
         $query = "UPDATE MultilingualPageRelations mpr, MultilingualSections \n\t\t\t\tSET mpr.mpLocale = MultilingualSections.msLocale\n\t\t\t\tWHERE mpr.mpLanguage = MultilingualSections.msLanguage";
         $db->query($query);
     }
     // 1.1.2
     $ak = CollectionAttributeKey::getByHandle('multilingual_exclude_from_copy');
     if (!is_object($ak)) {
         CollectionAttributeKey::add('BOOLEAN', array('akHandle' => 'multilingual_exclude_from_copy', 'akName' => t('Exclude from Internationalization Copy'), 'akIsSearchable' => true), $pkg);
     }
 }
開發者ID:Zyqsempai,項目名稱:amanet,代碼行數:32,代碼來源:controller.php

示例2: upgrade

 public function upgrade()
 {
     $pkg = $this;
     parent::upgrade();
     /*if (!is_object(BlockType::getByHandle('simple_info'))) {
           BlockType::installBlockTypeFromPackage('simple_info', $pkg);
       }*/
 }
開發者ID:robmorris180,項目名稱:lgt_events,代碼行數:8,代碼來源:controller.php

示例3: upgrade

 function upgrade()
 {
     parent::upgrade();
     /* Refresh all blocks */
     Loader::model('block_types');
     $items = array(BlockType::getByHandle('tweetcrete'));
     foreach ($items as $item) {
         $item->refresh();
     }
 }
開發者ID:robchenski,項目名稱:ids,代碼行數:10,代碼來源:controller.php

示例4: upgrade

 public function upgrade()
 {
     //		If you have an attribute type in your package that needs to
     //		update it's database table, you will need to run this:
     //
     //		$est = AttributeType::getByHandle('attribute_handle');
     //		$path = $est->getAttributeTypeFilePath(FILENAME_ATTRIBUTE_DB);
     //		Package::installDB($path);
     parent::upgrade();
     $pkg = Package::getByHandle($this->pkgHandle);
     $this->installAdditionalPageAttributes($pkg);
     $this->installJobs($pkg);
 }
開發者ID:janzenz,項目名稱:c5_boilerplate,代碼行數:13,代碼來源:controller.php

示例5: upgrade

 public function upgrade()
 {
     // In case the schema changed, drop all cobble tables
     $db = Loader::db();
     $db->Execute('DROP TABLE CobblePageThemes, CobblePageTypes, CobbleAreas, CobblePages, CobbleTemplateAreas');
     // This needs to be called AFTER dropping tables!
     parent::upgrade();
     // not using the job any more so remove it if it exists...
     Loader::model('job');
     $job = Job::getByHandle('cobble_refresh');
     if (!empty($job)) {
         $job->uninstall();
     }
 }
開發者ID:Remo,項目名稱:cobble,代碼行數:14,代碼來源:controller.php

示例6: upgrade

 public function upgrade()
 {
     parent::upgrade();
     if (is_writable("./jobs")) {
         $job = Job::getByHandle('si_mysql_optimize');
         if ($job) {
             $job->uninstall();
         }
         @unlink("./jobs/si_mysql_optimize.php");
         // We have to uninstall the package on the upgrade because on earlier versions the job was copied in the "/job/" directory.
         // In the new version we leave it in the "job" directory in the package. But this is the only way to upgrade, because
         // otherwise we would redeclare the class (here: "/job/si_mysql_optimize.php" and there "/packages/si_mysql_optimize/jobs/si_mysql_optimize.php")
         $this->uninstall();
     }
 }
開發者ID:katzueno,項目名稱:si_mysql_optimize,代碼行數:15,代碼來源:controller.php

示例7: upgrade

 public function upgrade()
 {
     $this->installOrUpgrade($this);
     parent::upgrade();
 }
開發者ID:jbh,項目名稱:c5_boilerplate_crud,代碼行數:5,代碼來源:controller.php

示例8: upgrade

 public function upgrade()
 {
     $pkg = Package::getByHandle($this->pkgHandle);
     $this->installPageLinkAttribute($pkg);
     parent::upgrade();
 }
開發者ID:robchenski,項目名稱:ids,代碼行數:6,代碼來源:controller.php

示例9: upgrade

 public function upgrade()
 {
     $fromVersion = $this->getPackageVersion();
     parent::upgrade();
     $this->installOrUpgrade($this, $fromVersion);
 }
開發者ID:mlocati,項目名稱:concrete5-handle_https,代碼行數:6,代碼來源:controller.php

示例10: upgrade

 public function upgrade()
 {
     parent::upgrade();
     $this->pkg = Package::getByHandle('remo_composer_list');
     $this->addBlock('remo_attribute_edit');
 }
開發者ID:haeflimi,項目名稱:concrete5-composer-list,代碼行數:6,代碼來源:controller.php


注:本文中的Package::upgrade方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。