本文整理匯總了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;
}