#4205 fix orphaned pages

skala
Juan Carlos Raña 13 years ago
parent 14b80c88db
commit 321f19d114
  1. 10
      main/wiki/index.php

@ -1245,6 +1245,7 @@ if ($_GET['action']=='orphaned') {
$pages = array();
$refs = array();
$list_refs = array();
$orphaned = array();
//get name pages
@ -1262,17 +1263,20 @@ if ($_GET['action']=='orphaned') {
while ($row=Database::fetch_array($allpages)) {
$row['linksto']= str_replace($row["reflink"], " ", trim($row["linksto"])); //remove self reference
$refs = explode(" ", trim($row["linksto"]));
$refs = array_unique($refs);
foreach ($refs as $ref_linked){
$array_refs_linked[]= $ref_linked;
}
}
$array_refs_linked = array_unique($array_refs_linked);
//search each name of list linksto into list reflink
foreach ($pages as $v) {
if (!in_array($v, $refs)) {
if (!in_array($v, $array_refs_linked)) {
$orphaned[] = $v;
}
}
foreach ($orphaned as $orphaned_show) {
// get visibility status and title
$sql='SELECT * FROM '.$tbl_wiki.' WHERE c_id = '.$course_id.' AND '.$groupfilter.$condition_session.' AND reflink="'.Database::escape_string($orphaned_show).'" GROUP BY reflink';

Loading…
Cancel
Save