本文整理汇总了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;
}