1<?php 2//include base config 3$inc = realpath(__DIR__.'/../../..'); 4define('DOKU_INC', $inc.'/'); 5 6// load and initialize the core system 7require_once(DOKU_INC.'inc/init.php'); 8 9echo "baseurl: " . $conf['baseurl'] . "\n"; 10echo "basedir: " . $conf['basedir'] . "\n"; 11 12 13function help() { 14 echo "cli.php purge\n"; 15 exit(0); 16} 17 18function purge() { 19 $action = new action_plugin_bez_base(); 20 $action->createObjects(true); 21 22 $threads = $action->get_model()->threadFactory->get_all(); 23 foreach ($threads as $thread) { 24 $thread->purge(); 25 $action->get_model()->threadFactory->save($thread); 26 echo "Thread #" . $thread->id . " purged\n"; 27 28 } 29 $thread_comments = $action->get_model()->thread_commentFactory->get_all(); 30 foreach ($thread_comments as $thread_comment) { 31 $thread_comment->purge(); 32 $action->get_model()->thread_commentFactory->save($thread_comment); 33 echo "Thread comment #k" . $thread_comment->id . " purged\n"; 34 35 } 36 37 $tasks = $action->get_model()->taskFactory->get_all(); 38 foreach ($tasks as $task) { 39 $task->purge(); 40 $action->get_model()->taskFactory->save($task); 41 echo "Task #z" . $task->id . " purged\n"; 42 43 } 44 45 $task_comments = $action->get_model()->task_commentFactory->get_all(); 46 foreach ($task_comments as $task_comment) { 47 $task_comment->purge(); 48 $action->get_model()->task_commentFactory->save($task_comment); 49 echo "Task comment #zk" . $task_comment->id . " purged\n"; 50 51 } 52 53} 54 55switch ($argv[1]) { 56 case 'purge': 57 purge(); 58 exit(0); 59 default: 60 help(); 61}