source: trunk/scripts/recursive-move @ 1184

Revision 1071, 742 bytes checked in by bogdan2412, 2 years ago (diff)

Merge changes from live.

  • Added a better date format for the roundparam macro.
  • Fixed check-attachments script.
  • Reverted some bad changes from update-ratings script.
  • Fixed recursive-move script.
  • Fixed attachment methods failing because of missing mem cache functions.
  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1#! /usr/bin/env php
2<?php
3
4require_once(dirname($argv[0]) . "/utilities.php");
5require_once(IA_ROOT_DIR . "common/db/textblock.php");
6
7log_print("Recursive page move, for huge changes.");
8db_connect();
9
10$src = read_line("Source root?", 'task');
11$dst = read_line("Destination root?", 'problema');
12
13$page_list = textblock_get_by_prefix($src, false, false);
14
15if (count($page_list) == 0) {
16    log_error("No pages found.");
17}
18
19if (!read_bool("Are you sure you want to move ".count($page_list)." pages?", false)) {
20    log_print("Aborted");
21    die();
22}
23
24foreach ($page_list as $page) {
25    $old_name = $page['name'];
26    $new_name = preg_replace("/^".preg_quote($src, '/').'/si', $dst, $old_name);
27    textblock_move($old_name, $new_name);
28}
29
30?>
Note: See TracBrowser for help on using the repository browser.