本文整理汇总了PHP中ewiki_db::DELETE方法的典型用法代码示例。如果您正苦于以下问题:PHP ewiki_db::DELETE方法的具体用法?PHP ewiki_db::DELETE怎么用?PHP ewiki_db::DELETE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ewiki_db
的用法示例。
在下文中一共展示了ewiki_db::DELETE方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ewiki_xpi_plugin_control_centre
function ewiki_xpi_plugin_control_centre()
{
ewiki_xpi_load_registry($registry, $registry_hash);
#-- title
$o = '<div class="xpi-settings"><h4>plugin control</h4>';
#-- delete plugins
if ($access && ($uu = $_REQUEST["xpi_rm"])) {
foreach ($uu as $id => $del) {
if ($del) {
$id = rawurldecode($id);
$dat = ewiki_db::GET($id);
$vZ = $dat["version"];
for ($v = 1; $v <= $vZ; $v++) {
ewiki_db::DELETE($id, $v);
}
unset($registry[$id]);
$vZ += 0;
$o .= "<b>i</b>: Purged {$vZ} versions of '{$id}' and removed xpi registry entry.<br /><br />";
ewiki_log("uninstalled .xpi/.jpi plugin '{$id}'", 0);
}
}
$_REQUEST["setup_xpi"] = 1;
}
#-- update config settings
if ($_REQUEST["setup_xpi"]) {
if ($access) {
foreach ($registry as $id => $uu) {
$registry[$id]["state"] = $_REQUEST["xpi_set"][rawurlencode($id)] ? 1 : 0;
}
$registry_hash["content"] = serialize($registry);
ewiki_data_update($registry_hash);
$registry_hash["version"]++;
ewiki_db::WRITE($registry_hash);
} else {
$o .= "You have no privileges to change the status of installed .xpi plugins.<br />\n";
}
}
#-- enable/disable checkboxes
$o .= '<table border="0" cellspacing="1" cellpadding="2">';
foreach ($registry as $dat) {
$enabled = $dat["state"] == 1;
$hard = $dat["type"] == "page";
$title = $hard ? ewiki_link($dat["id"]) : $dat["id"];
$o .= '<tr>' . '<td><tt>' . $dat["type"] . '</tt></td>' . '<td class="xs-check"><input type="checkbox" name="xpi_set[' . rawurlencode($dat["id"]) . ']" value="1"' . ($enabled ? " checked" : "") . ($hard ? " disabled" : "") . '></td>' . '<td class="xs-id">' . $title . '</td>' . '<td><small>' . htmlentities($dat["description"]) . '</small></td>' . '<td>' . $dat["author"] . ", " . $dat["license"] . '</td>' . '<td class="xs-check"><input type="submit" name="xpi_rm[' . rawurlencode($dat["id"]) . ']" value="rm" title="uninstall plugin"' . ($access ? "" : " disabled") . '></td>' . '</tr>';
}
$o .= '</table>';
$o .= '<br /><input type="submit" name="setup_xpi" value="configure"' . ($access ? "" : " disabled") . '>';
$o .= '</form></div>';
return $o;
}
示例2: cmd_ren
function cmd_ren($ls, $overwrite = 0)
{
if (count($ls) != 2) {
echo "mv: needs exactly two arguments\n";
} else {
$old = $ls[0];
$new = $ls[1];
echo htmlentities("{$old} -> {$new} ");
if (bad_old_new($old, $new)) {
return;
}
while ($data = get_almost_latest($data, $old)) {
$data["id"] = $new;
if (ewiki_db::WRITE($data, $overwrite)) {
if (ewiki_db::DELETE($old, $data["version"])) {
echo ".";
} else {
echo "<sup>(DE#{$data['version']})</sup>";
$de += 1;
}
} else {
echo "<sup>(WE#{$data['version']})</sup>";
$we += 1;
}
}
echo "\n<br><br>\n";
if ($we) {
echo "- {$we} write errors (target page existed)<br>\n";
}
if ($de) {
echo "- {$de} errors deleting source page versions (uh, bad!)<br>\n";
}
}
}
示例3: ewiki_action_control_page
function ewiki_action_control_page($id, &$data, $action)
{
global $ewiki_ring, $ewiki_config, $ewiki_plugins;
$a_flagnames = array("_TEXT", "_BINARY", "_DISABLED", "_HTML", "_READONLY", "_WRITEABLE", "_APPENDONLY", "_SYSTEM", "_PART", "_MINOR", "_HIDDEN", "_ARCHIVE", "_UU12", "_UU13", "_UU14", "_UU15", "_UU16", "_EXEC", "_UU18", "_UU19");
$o = ewiki_make_title($id, "control {$id}", 2);
#-- admin requ. ---------------------------------------------------------
if (!ewiki_auth($id, $data, $action, $ring = 0, "_FORCE_LOGIN=1") || !isset($ewiki_ring) || $ewiki_ring > 1) {
if (is_array($data)) {
$data = "You'll need to be admin. See ewiki_auth() and _PROTECTED_MODE in the README.";
}
$o .= $data;
} elseif (@$_REQUEST["pgc_setflags"]) {
#-- setted new flags
$new_f = 0;
foreach ($_REQUEST["sflag"] as $n => $b) {
if ($b) {
$new_f |= 1 << $n;
}
}
#-- administrator may change all flags
if ($ewiki_ring == 0) {
$data["flags"] = $new_f;
} else {
$data["flags"] = $data["flags"] & ~EWIKI_DB_F_MODERATORFLAGS | $new_f & EWIKI_DB_F_MODERATORFLAGS;
}
$data["lastmodified"] = time();
$data["version"]++;
if (ewiki_db::WRITE($data)) {
$o .= "Page flags were updated correctly.";
ewiki_log("page flags of '{$id}' were set to {$data['flags']}");
} else {
$o .= "A database error occoured.";
}
} elseif (@$_REQUEST["pgc_rename"] && strlen($new_id = $_REQUEST["mv_to"])) {
$old_id = $id;
$report = "";
$preg_id = "/" . addcslashes($old_id, ".+*?|/\\()\$[]^#") . "/" . ($_REQUEST["mv_cr1"] ? "i" : "");
#-- check if new name does not already exist in database
$exists = ewiki_db::GET($new_id);
if ($exists || !empty($exists)) {
return $o .= "Cannot overwrite an existing database entry.";
}
#-- copy from old name to new name
$max_ver = $data["version"];
$data = array();
for ($v = 1; $v <= $max_ver; $v++) {
$row = ewiki_db::GET($old_id, $v);
$row["id"] = $new_id;
$row["lastmodified"] = time();
$row["content"] = preg_replace($preg_id, $new_id, $row["content"]);
ewiki_scan_wikiwords($row["content"], $links, "_STRIP_EMAIL=1");
$row["refs"] = "\n\n" . implode("\n", array_keys($links)) . "\n\n";
$row["author"] = ewiki_author("control/");
if (!ewiki_db::WRITE($row)) {
$report .= "error while copying version {$v},<br />\n";
}
}
#-- proceed if previous actions error_free
if (empty($report)) {
#-- deleting old versions
for ($v = 1; $v <= $max_ver; $v++) {
ewiki_db::DELETE($old_id, $v);
}
#-- adjust links/references to old page name
if ($_REQUEST["mv_cr0"]) {
$result = ewiki_db::SEARCH("refs", $old_id);
while ($result && ($row = $result->get())) {
$row = ewiki_db::GET($row["id"]);
if (preg_match($preg_id, $row["content"], $uu)) {
$row["content"] = preg_replace($preg_id, $new_id, $row["content"]);
$row["lastmodified"] = time();
$row["version"]++;
ewiki_scan_wikiwords($row["content"], $links, "_STRIP_EMAIL=1");
$row["refs"] = "\n\n" . implode("\n", array_keys($links)) . "\n\n";
$row["author"] = ewiki_author("control/");
if (!ewiki_db::WRITE($row)) {
$report .= "could not update references in " . $row['id'] . ",<br />\n";
} else {
$report .= "updated references in " . $row['id'] . ",<br />\n";
}
}
}
}
$o .= "This page was correctly renamed from '{$old_id}' to '{$new_id}'.<br /><br />\n{$report}";
ewiki_log("page renamed from '{$old_id}' to '{$new_id}'", 2);
} else {
$o .= "Some problems occoured while processing your request, therefor the old page still exists:<br />\n" . $report;
}
} elseif (@$_REQUEST["pgc_setmeta"] && $ewiki_ring == 0 && ($set = explode("\n", $_REQUEST["pgc_meta"]))) {
$new_meta = array();
foreach ($set as $line) {
if (($line = trim($line)) && ($key = trim(strtok($line, ":"))) && ($value = trim(strtok("")))) {
$new_meta[$key] = $value;
}
}
$data["meta"] = $new_meta;
$data["lastmodified"] = time();
$data["version"]++;
if (ewiki_db::WRITE($data)) {
$o .= "The {meta} field was updated.";
//.........这里部分代码省略.........
示例4: versions
$id = $row["id"];
if ($row["flags"] & EWIKI_DB_F_ARCHIVE) {
continue;
}
$verZ = $row["version"] - $end;
$verA = $start;
#-- walk versions (top..down)
for ($ver = $verZ; $ver >= $verA; $v--) {
#-- interleave
if ($leave && !($ver % $leave)) {
continue;
}
#-- skip if too fresh
$row = ewiki_db::GET($id, $ver);
if ($row["lastmodified"] >= $t_skip) {
continue;
}
#-- check flags
if ($row["flags"] & EWIKI_DB_F_ARCHIVE) {
continue;
}
if ($row["flags"] & EWIKI_DB_F_READONLY) {
// has no meaning here(?!)
}
#-- else really delete it
ewiki_db::DELETE($id, $ver);
echo " {$id[$ver]}\n";
}
}
// GETALL
}
示例5: while
#-- look trough all previous revisions until $last timeframe,
# and compare {refs} for constant listing of all entries
while ($data = ewiki_db::GET($id, --$version)) {
#-- timeframe
if (time() >= $row["lastmodified"] + $last) {
break;
// done with version comparisions
}
#-- remove anything that isn't listed in all TrashCan page versions
$cmplist = explode("\n", trim($data["refs"]));
$listed = array_intersect($listed, $cmplist);
}
#-- delete anything that's still in the purge list
foreach ($listed as $id) {
#-- walk through all versions
if ($row = ewiki_db::GET($id)) {
echo " {$id}";
$version = $row["version"];
for ($version; $version >= 1; $version--) {
#-- don't kill revisions that have borought lifetime ($keptpages)
if ($row["lastmodified"] >= $keepuntil) {
continue;
}
#-- oh, so sad!
echo " [{$version}]";
ewiki_db::DELETE($id, $version);
}
echo "\n";
}
}
}
示例6: foreach
echo '
</table>
<br><input type="submit" value="strip page versions"><br>
</form>
<br>
[<a href="javascript:sel_all();">select all</a>]
<br>
<br>
Eventually you should consider using the <tt>ewikictl</tt> cmdline
utility in favour of this www script.
<br><br>
';
} else {
echo "purging page versions:<br>";
$range = $_REQUEST["range"];
foreach ($_REQUEST["id"] as $id_ue => $go) {
$id = rawurldecode($id_ue);
if ($go) {
if (preg_match('/^(\\d+)[-\\s._:]+(\\d+)$/', trim($range[$id_ue]), $uu)) {
$versA = $uu[1];
$versZ = $uu[2];
echo "'" . htmlentities($id) . "' versions {$versA}..{$versZ}<br>\n";
for ($v = $versA; $v <= $versZ; $v++) {
ewiki_db::DELETE($id, $v);
}
} else {
echo "wrong range param for '{$id}'!<br>\n";
}
}
}
}