当前位置: 首页>>代码示例>>PHP>>正文


PHP owa_coreAPI::updateFactory方法代码示例

本文整理汇总了PHP中owa_coreAPI::updateFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::updateFactory方法的具体用法?PHP owa_coreAPI::updateFactory怎么用?PHP owa_coreAPI::updateFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在owa_coreAPI的用法示例。


在下文中一共展示了owa_coreAPI::updateFactory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 /**
  * Checks for and applies schema upgrades for the module
  *
  */
 function update()
 {
     // list files in a directory
     $files = owa_lib::listDir(OWA_DIR . 'modules' . '/' . $this->name . '/' . 'updates', false);
     //print_r($files);
     $current_schema_version = $this->c->get($this->name, 'schema_version');
     // extract sequence
     foreach ($files as $k => $v) {
         // the use of %d casts the sequence number as an int which is critical for maintaining the
         // order of the keys in the array that we are going ot create that holds the update objs
         //$n = sscanf($v['name'], '%d_%s', $seq, $classname);
         $seq = substr($v['name'], 0, -4);
         settype($seq, "integer");
         if ($seq > $current_schema_version) {
             if ($seq <= $this->required_schema_version) {
                 $this->updates[$seq] = owa_coreAPI::updateFactory($this->name, substr($v['name'], 0, -4));
                 // if the cli update mode is required and we are not running via cli then return an error.
                 owa_coreAPI::debug('cli update mode required: ' . $this->updates[$seq]->isCliModeRequired());
                 if ($this->updates[$seq]->isCliModeRequired() === true && !defined('OWA_CLI')) {
                     //set flag in module
                     $this->update_from_cli_required = true;
                     owa_coreAPI::notice("Aborting update {$seq}. This update must be applied using the command line interface.");
                     return false;
                 }
                 // set schema version from sequence number in file name. This ensures that only one update
                 // class can ever be in use for a particular schema version
                 $this->updates[$seq]->schema_version = $seq;
             }
         }
     }
     // sort the array
     ksort($this->updates, SORT_NUMERIC);
     //print_r(array_keys($this->updates));
     foreach ($this->updates as $k => $obj) {
         $this->e->notice(sprintf("Applying Update %d (%s)", $k, get_class($obj)));
         $ret = $obj->apply();
         if ($ret == true) {
             $this->e->notice("Update Suceeded");
         } else {
             $this->e->notice("Update Failed");
             return false;
         }
     }
     return true;
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:49,代码来源:owa_module.php

示例2: rollback

 function rollback($update)
 {
     list($module, $seq) = explode('.', $update);
     $u = owa_coreAPI::updateFactory($module, $seq);
     $u->rollback();
     owa_coreAPI::notice("Rollback completed.");
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:7,代码来源:updatesApplyCli.php


注:本文中的owa_coreAPI::updateFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。