本文整理匯總了PHP中dibi::getAffectedRows方法的典型用法代碼示例。如果您正苦於以下問題:PHP dibi::getAffectedRows方法的具體用法?PHP dibi::getAffectedRows怎麽用?PHP dibi::getAffectedRows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dibi
的用法示例。
在下文中一共展示了dibi::getAffectedRows方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updateNodesIndex
/**
* @param AJXP_Node $oldNode
* @param AJXP_Node $newNode
* @param bool $copy
*/
public function updateNodesIndex($oldNode = null, $newNode = null, $copy = false)
{
if (!dibi::isConnected()) {
dibi::connect($this->sqlDriver);
}
//$this->logInfo("Syncable index", array($oldNode == null?'null':$oldNode->getUrl(), $newNode == null?'null':$newNode->getUrl()));
try {
if ($newNode != null && $this->excludeNode($newNode)) {
// CREATE
if ($oldNode == null) {
AJXP_Logger::debug("Ignoring " . $newNode->getUrl() . " for indexation");
return;
} else {
AJXP_Logger::debug("Target node is excluded, see it as a deletion: " . $newNode->getUrl());
$newNode = null;
}
}
if ($newNode == null) {
$repoId = $this->computeIdentifier($oldNode->getRepository(), $oldNode->getUser());
// DELETE
$this->logDebug('DELETE', $oldNode->getUrl());
dibi::query("DELETE FROM [ajxp_index] WHERE [node_path] LIKE %like~ AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
} else {
if ($oldNode == null || $copy) {
// CREATE
$stat = stat($newNode->getUrl());
$newNode->setLeaf(!($stat['mode'] & 040000));
$this->logDebug('INSERT', $newNode->getUrl());
dibi::query("INSERT INTO [ajxp_index]", array("node_path" => SystemTextEncoding::toUTF8($newNode->getPath()), "bytesize" => $stat["size"], "mtime" => $stat["mtime"], "md5" => $newNode->isLeaf() ? md5_file($newNode->getUrl()) : "directory", "repository_identifier" => $repoId = $this->computeIdentifier($newNode->getRepository(), $newNode->getUser())));
} else {
$repoId = $this->computeIdentifier($oldNode->getRepository(), $oldNode->getUser());
if ($oldNode->getPath() == $newNode->getPath()) {
// CONTENT CHANGE
clearstatcache();
$stat = stat($newNode->getUrl());
$this->logDebug("Content changed", "current stat size is : " . $stat["size"]);
$this->logDebug('UPDATE CONTENT', $newNode->getUrl());
dibi::query("UPDATE [ajxp_index] SET ", array("bytesize" => $stat["size"], "mtime" => $stat["mtime"], "md5" => md5_file($newNode->getUrl())), "WHERE [node_path] = %s AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
try {
$rowCount = dibi::getAffectedRows();
if ($rowCount === 0) {
$this->logError(__FUNCTION__, "There was an update event on a non-indexed node (" . $newNode->getPath() . "), creating index entry!");
$this->updateNodesIndex(null, $newNode, false);
}
} catch (Exception $e) {
}
} else {
// PATH CHANGE ONLY
$newNode->loadNodeInfo();
if ($newNode->isLeaf()) {
$this->logDebug('UPDATE LEAF PATH', $newNode->getUrl());
dibi::query("UPDATE [ajxp_index] SET ", array("node_path" => SystemTextEncoding::toUTF8($newNode->getPath())), "WHERE [node_path] = %s AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
try {
$rowCount = dibi::getAffectedRows();
if ($rowCount === 0) {
$this->logError(__FUNCTION__, "There was an update event on a non-indexed node (" . $newNode->getPath() . "), creating index entry!");
$this->updateNodesIndex(null, $newNode, false);
}
} catch (Exception $e) {
}
} else {
$this->logDebug('UPDATE FOLDER PATH', $newNode->getUrl());
dibi::query("UPDATE [ajxp_index] SET [node_path]=REPLACE( REPLACE(CONCAT('\$\$\$',[node_path]), CONCAT('\$\$\$', %s), CONCAT('\$\$\$', %s)) , '\$\$\$', '') ", $oldNode->getPath(), $newNode->getPath(), "WHERE [node_path] LIKE %like~ AND [repository_identifier] = %s", SystemTextEncoding::toUTF8($oldNode->getPath()), $repoId);
try {
$rowCount = dibi::getAffectedRows();
if ($rowCount === 0) {
$this->logError(__FUNCTION__, "There was an update event on a non-indexed folder (" . $newNode->getPath() . "), relaunching a recursive indexation!");
AJXP_Controller::findActionAndApply("index", array("file" => $newNode->getPath()), array());
}
} catch (Exception $e) {
}
}
}
}
}
} catch (Exception $e) {
AJXP_Logger::error("[meta.syncable]", "Exception", $e->getTraceAsString());
AJXP_Logger::error("[meta.syncable]", "Indexation", $e->getMessage());
}
}