本文整理汇总了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);
}
}
示例2: upgrade
public function upgrade()
{
$pkg = $this;
parent::upgrade();
/*if (!is_object(BlockType::getByHandle('simple_info'))) {
BlockType::installBlockTypeFromPackage('simple_info', $pkg);
}*/
}
示例3: upgrade
function upgrade()
{
parent::upgrade();
/* Refresh all blocks */
Loader::model('block_types');
$items = array(BlockType::getByHandle('tweetcrete'));
foreach ($items as $item) {
$item->refresh();
}
}
示例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);
}
示例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();
}
}
示例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();
}
}
示例7: upgrade
public function upgrade()
{
$this->installOrUpgrade($this);
parent::upgrade();
}
示例8: upgrade
public function upgrade()
{
$pkg = Package::getByHandle($this->pkgHandle);
$this->installPageLinkAttribute($pkg);
parent::upgrade();
}
示例9: upgrade
public function upgrade()
{
$fromVersion = $this->getPackageVersion();
parent::upgrade();
$this->installOrUpgrade($this, $fromVersion);
}
示例10: upgrade
public function upgrade()
{
parent::upgrade();
$this->pkg = Package::getByHandle('remo_composer_list');
$this->addBlock('remo_attribute_edit');
}