• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisão3e9f1ee95a3a67f919dedd02ad0acc4efcab0877 (tree)
Hora2017-10-31 00:25:57
Autorumorigu <umorigu@gmai...>
Commiterumorigu

Mensagem de Log

BugTrack/2445 Rename deleted page

Mudança Sumário

Diff

--- a/plugin/rename.inc.php
+++ b/plugin/rename.inc.php
@@ -25,7 +25,7 @@ function plugin_rename_action()
2525 if ($src == '') return plugin_rename_phase1();
2626
2727 $src_pattern = '/' . preg_quote($src, '/') . '/';
28- $arr0 = preg_grep($src_pattern, get_existpages());
28+ $arr0 = preg_grep($src_pattern, plugin_rename_get_existpages());
2929 if (! is_array($arr0) || empty($arr0))
3030 return plugin_rename_phase1('nomatch');
3131
@@ -45,7 +45,7 @@ function plugin_rename_action()
4545 if ($refer == '') {
4646 return plugin_rename_phase1();
4747
48- } else if (! is_page($refer)) {
48+ } else if (! plugin_rename_is_page($refer)) {
4949 return plugin_rename_phase1('notpage', $refer);
5050
5151 } else if ($refer === $whatsnew) {
@@ -405,7 +405,7 @@ function plugin_rename_proceed($pages, $files, $exists)
405405 function plugin_rename_getrelated($page)
406406 {
407407 $related = array();
408- $pages = get_existpages();
408+ $pages = plugin_rename_get_existpages();
409409 $pattern = '/(?:^|\/)' . preg_quote(strip_bracket($page), '/') . '(?:\/|$)/';
410410 foreach ($pages as $name) {
411411 if ($name === $page) continue;
@@ -419,7 +419,7 @@ function plugin_rename_getselecttag($page)
419419 global $whatsnew;
420420
421421 $pages = array();
422- foreach (get_existpages() as $_page) {
422+ foreach (plugin_rename_get_existpages() as $_page) {
423423 if ($_page === $whatsnew) continue;
424424
425425 $selected = ($_page === $page) ? ' selected' : '';
@@ -438,3 +438,40 @@ function plugin_rename_getselecttag($page)
438438 EOD;
439439
440440 }
441+
442+/**
443+ * List exist pages and deleted pages
444+ */
445+function plugin_rename_get_existpages() {
446+ $list1 = array_values(get_existpages());
447+ $list2 = array_values(get_existpages(DIFF_DIR, '.txt'));
448+ $list3 = array_values(get_existpages(BACKUP_DIR, '.txt'));
449+ $list4 = array_values(get_existpages(BACKUP_DIR, '.gz'));
450+ $list5 = array_values(get_existpages(COUNTER_DIR, '.count'));
451+ $wholelist = array_merge($list1, $list2, $list3, $list4, $list5);
452+ $list = array_unique($wholelist);
453+ return $list;
454+}
455+
456+/**
457+ * Return where the page exists or existed
458+ */
459+function plugin_rename_is_page($page) {
460+ $enc = encode($page);
461+ if (is_page($page)) {
462+ return true;
463+ }
464+ if (file_exists(DIFF_DIR . $enc . '.txt')) {
465+ return true;
466+ }
467+ if (file_exists(BACKUP_DIR . $enc . '.txt')) {
468+ return true;
469+ }
470+ if (file_exists(BACKUP_DIR . $enc . '.gz')) {
471+ return true;
472+ }
473+ if (file_exists(COUNTER_DIR . $enc . '.count')) {
474+ return true;
475+ }
476+ return false;
477+}