當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。