[geeklog-cvs] geeklog: Removed old script to add indexes to some tables
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Mon Jan 5 05:06:59 EST 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/d9f30084e9c5
changeset: 6623:d9f30084e9c5
user: Dirk Haun <dirk at haun-online.de>
date: Thu Jan 01 13:37:41 2009 +0100
description:
Removed old script to add indexes to some tables
diffstat:
1 file changed, 145 deletions(-)
public_html/admin/install/addindex.php | 145 --------------------------------
diffs (149 lines):
diff -r 1ba00656781c -r d9f30084e9c5 public_html/admin/install/addindex.php
--- a/public_html/admin/install/addindex.php Thu Jan 01 12:15:36 2009 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-<?php
-
-/* Reminder: always indent with 4 spaces (no tabs). */
-// +---------------------------------------------------------------------------+
-// | Geeklog 1.3 |
-// +---------------------------------------------------------------------------+
-// | addindex.php |
-// | Add index field to Geeklog tables. |
-// | |
-// +---------------------------------------------------------------------------+
-// | Copyright (C) 2002 by the following authors: |
-// | |
-// | Authors: Dirk Haun - dirk at haun-online.de |
-// | with the help of Jeffrey Schoolcraft, Marc von Ahn, and Rob Griffiths |
-// +---------------------------------------------------------------------------+
-// | |
-// | This program is free software; you can redistribute it and/or |
-// | modify it under the terms of the GNU General Public License |
-// | as published by the Free Software Foundation; either version 2 |
-// | of the License, or (at your option) any later version. |
-// | |
-// | This program is distributed in the hope that it will be useful, |
-// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
-// | GNU General Public License for more details. |
-// | |
-// | You should have received a copy of the GNU General Public License |
-// | along with this program; if not, write to the Free Software Foundation, |
-// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
-// | |
-// +---------------------------------------------------------------------------+
-//
-// $Id: addindex.php,v 1.4 2007/11/25 06:58:55 ospiess Exp $
-
-
-// Add missing indexes to Geeklog tables
-//
-// Date Version Author
-// ---- ------- ------
-// 2002-10-22 0.1 Dirk Haun <dirk at haun-online.de>
-// Initial version
-// 2002-11-24 0.2 Dirk Haun <dirk at haun-online.de>
-// Added key names for the indexes, added authentication check
-
-require_once('../../lib-common.php');
-
-if (!SEC_inGroup ('Root')) {
- COM_errorLog ("Access denied to {$PHP_SELF} for user {$_USER['username']}, IP=" . $_SERVER['REMOTE_ADDR']);
- $display = COM_siteHeader('menu');
- $display .= COM_startBlock($LANG20[1]);
- $display .= $LANG20[6];
- $display .= COM_endBlock();
- $display .= COM_siteFooter();
- echo $display;
- exit;
-}
-
-// $_DEBUG = 1;
-
-// list according to Jeff's post on geeklog-devel (2002-10-14)
-// plus stories.hits (Rob Griffiths) plus group_assignments.ug_uid
-// <http://www.geeklog.net/article.php?story=20021011151827972>
-
-$index['comments'] = "cid,type,sid,date,uid";
-$index['stories'] = "sid,tid,date,uid,frontpage,featured,hits";
-$index['blocks'] = "bid,is_enabled,tid,type";
-$index['events'] = "eid,datestart,dateend,event_type";
-$index['links'] = "lid,category,date";
-$index['pollquestions'] = "qid,date,display,commentcode,statuscode";
-$index['staticpage'] = "sp_id,sp_uid,sp_date,sp_onmenu";
-$index['userindex'] = "uid,noboxes,maxstories";
-$index['group_assignments'] = "ug_main_grp_id,ug_uid";
-
-
-echo COM_siteHeader('menu');
-echo COM_startBlock("Updating indexes ...");
-
-foreach ($index as $table=>$fields) {
-
- $idx = explode (",", $fields);
-
- echo "<p>Table: {$_TABLES[$table]}</p>";
-
- if ($_DEBUG) {
- echo "<p>Wanted: ";
- foreach ($idx as $id) {
- echo "$id, ";
- }
- echo "</p>";
- }
-
- $result = DB_query ("show index from {$_TABLES[$table]}");
- $nrows = DB_numRows ($result);
- $exidx = array ();
- for ($i = 0; $i < $nrows; $i++) {
- $A = DB_fetchArray ($result);
- $exidx[] = $A['Column_name'];
- }
- $newidx = array_diff ($idx, $exidx);
-
- if ($_DEBUG) {
- echo "<p>Existing: ";
- foreach ($exidx as $ex) {
- echo "$ex, ";
- }
- echo "</p>";
- }
-
- if ($_DEBUG) {
- echo "<p>Need to add: ";
- foreach ($newidx as $ne) {
- echo "$ne, ";
- }
- echo "</p>";
- }
-
- if (sizeof ($newidx) > 0) {
- echo "<p>Adding indexes ...<br" . XHTML . ">";
- foreach ($newidx as $ne) {
- $idxname = $table . '_' . $ne;
- echo "Adding index \"$idxname\"";
- flush ();
-
- $idxtimer = new timerobject ();
- $idxtimer->setPercision (4);
- $idxtimer->startTimer ();
-
- DB_query("ALTER TABLE {$_TABLES[$table]} ADD INDEX $idxname ($ne)");
-
- $idxtime = $idxtimer->stopTimer ();
- $idxtimer->setPercision (4);
- echo " in $idxtime seconds<br" . XHTML . ">";
- }
- echo "Done!</p>";
- } else {
- echo "<p>No index to add for table {$_TABLES[$table]}</p>";
- }
-
- echo "<hr" . XHTML . ">";
-}
-
-echo COM_endBlock();
-echo COM_siteFooter();
-
-?>
More information about the geeklog-cvs
mailing list