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


PHP Zotero_DB::isReadOnly方法代码示例

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


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

示例1: getVersion

 /**
  * Get library version from the database
  */
 public static function getVersion($libraryID)
 {
     // Default empty library
     if ($libraryID === 0) {
         return 0;
     }
     $sql = "SELECT version FROM shardLibraries WHERE libraryID=?";
     $version = Zotero_DB::valueQuery($sql, $libraryID, Zotero_Shards::getByLibraryID($libraryID));
     // TEMP: Remove after classic sync, and use shardLibraries only for version info?
     if (!$version || $version == 1) {
         $shardID = Zotero_Shards::getByLibraryID($libraryID);
         $readOnly = Zotero_DB::isReadOnly($shardID);
         $sql = "SELECT lastUpdated, version FROM libraries WHERE libraryID=?";
         $row = Zotero_DB::rowQuery($sql, $libraryID);
         $sql = "UPDATE shardLibraries SET version=?, lastUpdated=? WHERE libraryID=?";
         Zotero_DB::query($sql, array($row['version'], $row['lastUpdated'], $libraryID), $shardID, ['writeInReadMode' => true]);
         $sql = "SELECT IFNULL(IF(MAX(version)=0, 1, MAX(version)), 1) FROM items WHERE libraryID=?";
         $version = Zotero_DB::valueQuery($sql, $libraryID, $shardID);
         $sql = "UPDATE shardLibraries SET version=? WHERE libraryID=?";
         Zotero_DB::query($sql, [$version, $libraryID], $shardID, ['writeInReadMode' => true]);
     }
     // Store original version for use by getOriginalVersion()
     if (!isset(self::$originalVersions[$libraryID])) {
         self::$originalVersions[$libraryID] = $version;
     }
     return $version;
 }
开发者ID:ergo70,项目名称:dataserver,代码行数:30,代码来源:Libraries.inc.php


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