Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F773175
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 2, 3:57 AM
Size
10 KB
Mime Type
text/x-diff
Expires
Tue, Feb 4, 3:57 AM (1 d, 15 h)
Engine
blob
Format
Raw Data
Handle
556430
Attached To
rINP In-Portal
in-portal
View Options
Index: trunk/admin/category/category_maint.php
===================================================================
--- trunk/admin/category/category_maint.php (revision 564)
+++ trunk/admin/category/category_maint.php (revision 565)
@@ -1,245 +1,122 @@
-<?php
+<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
## Intechnic Corporation ##
## All Rights Reserved, 1998-2002 ##
-## ##
-## No portion of this code may be copied, reproduced or ##
+## ##
+## No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
-
+if(!defined('CACHE_PERM_CHUNK_SIZE'))define('CACHE_PERM_CHUNK_SIZE',30);
if(!strlen($pathtoroot))
{
$path = dirname(realpath(__FILE__));
if( strlen($path) )
{
// determine the OS type for path parsing
$pos = strpos($path, ':');
$gOS_TYPE = ($pos === false) ? 'unix' : 'win';
$pathchar = ($gOS_TYPE == 'unix') ? '/' : "\\";
$p = $path.$pathchar;
-
+
// Start looking for the root flag file
while( !strlen($pathtoroot) && strlen($p) )
{
$sub = substr($p, strlen($pathchar) * -1);
$filename = $p.( ($sub == $pathchar) ? '' : $pathchar).'root.flg';
if( !file_exists($filename) )
{
$parent = realpath($p.$pathchar."..".$pathchar);
$p = ($parent != $p) ? $parent : '';
}
else
$pathtoroot = $p;
}
if( !strlen($pathtoroot) ) $pathtoroot = '.'.$pathchar;
}
else
$pathtoroot = '.'.$pathchar;
}
$sub = substr($pathtoroot,strlen($pathchar)*-1);
if( $sub != $pathchar) $pathtoroot = $pathtoroot.$pathchar;
//echo $pathtoroot;
//$FrontEnd=2;
require_once($pathtoroot."kernel/startup.php");
//admin only util
$rootURL="http://".ThisDomain().$objConfig->Get("Site_Path");
$admin = $objConfig->Get("AdminDirectory");
if(!strlen($admin))
$admin = "admin";
$localURL=$rootURL."kernel/";
$adminURL = $rootURL.$admin;
-$imagesURL = $adminURL."/images";
-//$pathtolocal = $pathtoroot."in-news/";
-require_once ($pathtoroot.$admin."/include/elements.php");
-require_once ($pathtoroot."kernel/admin/include/navmenu.php");
-//require_once ($pathtolocal."admin/include/navmenu.php");
+$imagesURL = $adminURL."/images";
+$pathtolocal = $pathtoroot."in-news/";
+require_once ($pathtoroot.$admin."/include/elements.php");
+require_once ($pathtoroot."kernel/admin/include/navmenu.php");
+require_once ($pathtolocal."admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
-
$section = "in-portal:category_maint";
-$CatsPerLoad = 10;
-$ado = &GetADODBConnection();
-// init vars
-if( !isset($NumCats) ) $NumCats = 0;
-if( !isset($CatIndex) ) $CatIndex = 0;
+require_once($pathtoroot.$admin."/category/permcacheupdate.php");
+
+if(!$objSession->GetVariable('PermCache_UpdateRequired'))
+ die(header('Location: '.$adminURL.'/'.$objSession->GetVariable('ReturnScript').'?env='.BuildEnv()));
-if( !is_numeric( GetVar('CatIndex') ) )
-{
- unset($objEditItems);
- $objEditItems = new clsCatList();
- $objEditItems->SourceTable = $objSession->GetEditTable("Category");
- $table = $objEditItems->SourceTable;
- //echo "Dropping Table..<br>\n";
- @$ado->Execute("DROP TABLE IF EXISTS $table");
-
- if($objCatList->CurrentCategoryID()>0)
- {
- $c = $objCatList->GetItem($objCatList->CurrentCategoryID());
- $path = $c->Get("ParentPath");
- $sql = "SELECT CategoryId,ParentPath FROM ".$objCatList->SourceTable." WHERE ParentPath LIKE '".$path."%'";
- $ado->Execute("CREATE TABLE $table ".$sql);
- }
- else
- {
- $sql = "SELECT CategoryId,ParentPath FROM ".$objCatList->SourceTable;
- $objEditTable->SourceTable = $objCatList->SourceTable;
- $table = $objCatList->SourceTable;
- }
- $NumCats = TableCount($table,"",0);
-
- $title = prompt_language("la_prompt_updating")." ".prompt_language("la_Text_Categories");
- int_header(NULL,NULL,$title);
- flush();
+if (isset($_GET['continue'])) {
+ $updater =& new clsCacheUpdater(1);
}
-elseif( is_numeric($_GET["CatIndex"]) )
-{
- $NumCats = $_REQUEST['NumCats'];
- $CatIndex = (int)$_REQUEST['CatIndex'];
- $table = ($objCatList->CurrentCategoryID() > 0) ? $objSession->GetEditTable("Category") : $objCatList->SourceTable;
- //echo $NumCats." Loaded <br>\n";
- $title = prompt_language("la_prompt_updating")." ".prompt_language("la_Text_Categories");
- $title .= " $CatIndex / $NumCats ".prompt_language("la_Text_complete");
- int_header(NULL,NULL,$title);
- flush();
-
- $sql = "SELECT * FROM $table ORDER BY ParentPath ASC LIMIT $CatIndex,$CatsPerLoad";
-
- $objCatList->Query_Item($sql);
- foreach($objCatList->Items as $cat)
- {
- $cat->UpdateACL();
- $cat->UpdateCachedPath();
- }
+else {
+ $updater =& new clsCacheUpdater();
}
+
+$title = prompt_language("la_prompt_updating")." ".prompt_language("la_Text_Categories");
+$title .= " $CatIndex / $NumCats ".prompt_language("la_Text_complete");
+int_header(NULL,NULL,$title);
+flush();
+$percent=$updater->getDonePercent();
+echo '<TABLE cellspacing="0" cellpadding="2" width="100%" border="0" class="tableborder">';
+if ($percent == 0)
+ echo '<TR><TD BGCOLOR="#FFFFFF" width="100%" >'.$percent.'%</td></TR>';
+else if ($percent < 60)
+ echo '<TR><TD BGCOLOR="#4682B2" width="'.$percent.'%"></td><TD BGCOLOR="#FFFFFF" width="'.(100-$percent).'%">'.$percent.'%</td></TR>';
+else if ($percent == 100)
+ echo '<TR><TD BGCOLOR="#4682B2" align="right" width="100%"><FONT COLOR="#FFFFFF">'.$percent.'%</FONT></td>';
else
+ echo '<TR><TD BGCOLOR="#4682B2" align="right" width="'.$percent.'%"><FONT COLOR="#FFFFFF">'.$percent.'%</FONT></td><TD BGCOLOR="#FFFFFF" width="'.(100-$percent).'%"></td></TR>';
+echo '</TABLE>';
+flush();
+
+$needs_more = TRUE;
+while ($needs_more && $updater->iteration < CACHE_PERM_CHUNK_SIZE) {
+ $needs_more = $updater->DoTheJob();
+}
+if ($needs_more)
{
- $title = prompt_language("la_prompt_updating")." ".prompt_language("la_Text_Categories");
- int_header(NULL,NULL,$title);
- flush();
-}
-
-$no_url = $adminURL.'/'.$objSession->GetVariable('ReturnScript').'?env='.BuildEnv();
-$yes_url = $_SERVER['PHP_SELF'].'?env='.BuildEnv().'&CatIndex=0&NumCats='.$NumCats;
-$cat_update = $objSession->GetVariable('PermCache_UpdateRequired');
-
-
-?>
-<TABLE cellspacing="0" cellpadding="2" width="100%" border="0" class="tableborder">
-<script language="javascript">
- function goto_url(url)
- {
- document.location = url;
- }
- <?php if( !$cat_update )
- {
- $objSession->SetVariable('PermCache_UpdateRequired', 0);
- echo "goto_url('$no_url');\n";
- }
- ?>
-</script>
-<?php
-
-
-if(!is_numeric( GetVar('CatIndex') ) && $NumCats > $CatsPerLoad)
+ $updater->setData();
+ $url=$adminURL.'/category/category_maint.php?env='.BuildEnv().'&continue=1';
+}
+else
{
- int_subsection_title(prompt_language("la_confirm_maintenance"));
-
-
-?>
- <tr>
- <td align="center" colspan="3" bgcolor="#FFFFFF"><?php echo prompt_language("la_prompt_perform_now"); ?></td>
- </tr>
- <tr>
- <td align="right" width="50%">
- <input type="button" name="yes_btn" value="<?php echo admin_language("lu_yes"); ?>" onclick="javascript:goto_url('<?php echo $yes_url; ?>');" class="button">
- </td>
- <td><img src="<?php echo $imagesURL; ?>/spacer.gif" width="10"></td>
- <td align="left" width="50%">
- <input type="button" name="yes_btn" value="<?php echo admin_language("lu_no"); ?>" onclick="javascript:goto_url('<?php echo $no_url; ?>');" class="button">
- </td>
- </tr>
-</table>
-<?php
- int_footer();
- die();
+ $updater->clearData();
+ $url = $adminURL.'/'.$objSession->GetVariable('ReturnScript').'?env='.BuildEnv();
+ $objSession->SetVariable('PermCache_UpdateRequired', 0);
}
+print "<script language=\"javascript\">" ;
+print "setTimeout(\"document.location='$url';\",40);";
+print " </script>";
+int_footer();
+exit;
?>
-<?php int_subsection_title(""); ?>
-<?php
- if($NumCats==0)
- {
- $percent=100;
- }
- else
- {
- $percent = (int)(($CatIndex/$NumCats) * 100);
- }
-
- if( is_numeric( GetVar('CatIndex') ) )
- {
- if ($percent == 0)
- {
- echo "<TR>";
- echo "<TD BGCOLOR=\"#FFFFFF\" width=\"100%\" >$percent";
- echo "%</td></TR>";
- }
- else if ($percent < 60)
- {
- echo "<TR><TD BGCOLOR=\"#4682B2\" width=\"".$percent."%\" >";
- $row2 = 100-$percent;
- echo "</td> <TD BGCOLOR=\"#FFFFFF\" width=\"".$row2."%\" > $percent";
- echo "%</td></TR>";
- }
- else if ($percent == 100)
- {
- echo "<TR><TD BGCOLOR=\"#4682B2\" align=\"right\" width=\"100%\" ><FONT COLOR=\"#FFFFFF\">$percent%</FONT></td>";
- }
- else
- {
- echo "<TR><TD BGCOLOR=\"#4682B2\" align=\"right\" width=\"".$percent."%\" ><FONT COLOR=\"#FFFFFF\">$percent%</FONT>";
- $row2 = 100-$percent;
- echo "</td> <TD BGCOLOR=\"#FFFFFF\" width=\"".$row2."%\" ></td></TR>";
- }
- }
- flush();
-?>
-</TABLE>
-<?php
- if($CatIndex+1 >$NumCats)
- {
- $objSession->SetVariable('PermCache_UpdateRequired', 0);
- $target = $adminURL."/".$objSession->GetVariable('ReturnScript').'?env='.BuildEnv();
- }
- else
- {
- $next = $CatIndex+$CatsPerLoad;
- if($next > $NumCats)
- {
- $objSession->SetVariable('PermCache_UpdateRequired', 0);
- $target = $adminURL."/".$objSession->GetVariable('ReturnScript').'?env='.BuildEnv();
- }
- else
- $target = $_SERVER["PHP_SELF"]."?env=".BuildEnv()."&CatIndex=".$next."&NumCats=$NumCats";
- }
-
- //print "<A HREF=\"$target\">$target</A>";
-
- print "<script language=\"javascript\">" ;
- print "setTimeout(\"document.location='$target';\",40);";
- print " </script>";
-?>
-<?php int_footer(); ?>
Property changes on: trunk/admin/category/category_maint.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.10
\ No newline at end of property
+1.11
\ No newline at end of property
Event Timeline
Log In to Comment