Skip to content
Browse files

scan on namespace fixes

scan on a namespace dose:
 - counts deleted pages
 - supports only small changes
 - supports don't delete changes with a comment
  • Loading branch information...
1 parent 1522018 commit d30494f7ceb02a4e837304e4211df8074b62fc6c dominik committed
Showing with 9 additions and 4 deletions.
  1. +9 −4 admin.php
View
13 admin.php
@@ -52,7 +52,7 @@ function handle() {
$this->_scanRecents( 30 , $onlySmall , $onlyNoComment );
} else if ($_GET['clear'] == 2) {
$_GET['ns'] = cleanID($_GET['ns']);
- $this->_scan($_GET['ns'] , $onlySmall , $onlyNoComment );
+ $this->_scanNamespace($_GET['ns'] , $onlySmall , $onlyNoComment );
}
msg(sprintf($this->getLang('deleted'),$this->delcounter),1);
}
@@ -89,11 +89,17 @@ function html() {
echo '<p class="clearhistory">'.$this->getLang('desctext').'</p>';
}
+ function _scanNamespace($ns, $onlySmall = false, $onlyNoComment = false) {
+ $this->delcounter = 0;
+ $this->_scan($ns, $onlySmall, $onlyNoComment);
+ }
+
+
/**
* Scans namespaces for deletable revisions
* @param string ns the namespace to search in
*/
- function _scan($ns = '') {
+ function _scan($ns = '', $onlySmall = false, $onlyNoComment = false) {
$dir = preg_replace('/\.txt(\.gz)?/i','', wikiFN($ns));
$dir = rtrim($dir,'/');
if (!is_dir($dir)) return;
@@ -102,7 +108,6 @@ function _scan($ns = '') {
echo 'error';
return;
}
- $this->delcounter = 0;
while (($file = readdir($dh)) !== false) {
if ($file == '.' || $file == '..' ) continue;
if (is_dir($dir.'/'.$file)) {
@@ -112,7 +117,7 @@ function _scan($ns = '') {
if ($file[0] == '_') continue;
if (substr($file,-4) == '.txt') {
$name = substr($file,0,-4);
- $this->_parseChangesFile(metaFN($ns.':'.$name,'.changes'),$ns.':'.$name);
+ $this->_parseChangesFile(metaFN($ns.':'.$name,'.changes'),$ns.':'.$name, $onlySmall, $onlyNoComment);
}
}
closedir($dh);

0 comments on commit d30494f

Please sign in to comment.
Something went wrong with that request. Please try again.