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


PHP restore_dbops::backupidsexistsize方法代码示例

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


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

示例1: get_backup_ids_cached

 /**
  * Return cached backup id's
  *
  * @param int $restoreid id of backup
  * @param string $itemname name of the item
  * @param int $itemid id of item
  * @return array backup id's
  * @todo MDL-25290 replace static backupids* with MUC code
  */
 protected static function get_backup_ids_cached($restoreid, $itemname, $itemid)
 {
     global $DB;
     $key = "{$itemid} {$itemname} {$restoreid}";
     // If record exists in cache then return.
     if (isset(self::$backupidsexist[$key]) && isset(self::$backupidscache[$key])) {
         // Return a copy of cached data, to avoid any alterations in cached data.
         return clone self::$backupidscache[$key];
     }
     // Clean cache, if it's full.
     if (self::$backupidscachesize <= 0) {
         // Remove some records, to keep memory in limit.
         self::$backupidscache = array_slice(self::$backupidscache, self::$backupidsslice, null, true);
         self::$backupidscachesize = self::$backupidscachesize + self::$backupidsslice;
     }
     if (self::$backupidsexistsize <= 0) {
         self::$backupidsexist = array_slice(self::$backupidsexist, self::$backupidsslice, null, true);
         self::$backupidsexistsize = self::$backupidsexistsize + self::$backupidsslice;
     }
     // Retrive record from database.
     $record = array('backupid' => $restoreid, 'itemname' => $itemname, 'itemid' => $itemid);
     if ($dbrec = $DB->get_record('backup_ids_temp', $record)) {
         self::$backupidsexist[$key] = $dbrec->id;
         self::$backupidscache[$key] = $dbrec;
         self::$backupidscachesize--;
         self::$backupidsexistsize--;
         return $dbrec;
     } else {
         return false;
     }
 }
开发者ID:nicusX,项目名称:moodle,代码行数:40,代码来源:restore_dbops.class.php

示例2: reset_backup_ids_cached

 /**
  * Reset the ids caches completely
  *
  * Any destructive operation (partial delete, truncate, drop or recreate) performed
  * with the backup_ids table must cause the backup_ids caches to be
  * invalidated by calling this method. See MDL-33630.
  *
  * Note that right now, the only operation of that type is the recreation
  * (drop & restore) of the table that may happen once the prechecks have ended. All
  * the rest of operations are always routed via {@link set_backup_ids_record()}, 1 by 1,
  * keeping the caches on sync.
  *
  * @todo MDL-25290 static should be replaced with MUC code.
  */
 public static function reset_backup_ids_cached()
 {
     // Reset the ids cache.
     $cachetoadd = count(self::$backupidscache);
     self::$backupidscache = array();
     self::$backupidscachesize = self::$backupidscachesize + $cachetoadd;
     // Reset the exists cache.
     $existstoadd = count(self::$backupidsexist);
     self::$backupidsexist = array();
     self::$backupidsexistsize = self::$backupidsexistsize + $existstoadd;
 }
开发者ID:Burick,项目名称:moodle,代码行数:25,代码来源:restore_dbops.class.php


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