From: <var...@us...> - 2021-07-29 19:32:26
|
Revision: 10399 http://sourceforge.net/p/phpwiki/code/10399 Author: vargenau Date: 2021-07-29 19:32:25 +0000 (Thu, 29 Jul 2021) Log Message: ----------- lib/upgrade.php: remove unused functions installTable and _convert_cached_html Modified Paths: -------------- trunk/lib/upgrade.php Modified: trunk/lib/upgrade.php =================================================================== --- trunk/lib/upgrade.php 2021-07-29 19:11:48 UTC (rev 10398) +++ trunk/lib/upgrade.php 2021-07-29 19:32:25 UTC (rev 10399) @@ -152,7 +152,8 @@ if ($translation == $pagename) $this->doPgsrcUpdate($pagename, $path, $filename); elseif (findLocalizedFile('pgsrc/' . urlencode($translation), 1)) - $this->doPgsrcUpdate($translation, $loc_path, urlencode($translation)); else + $this->doPgsrcUpdate($translation, $loc_path, urlencode($translation)); + else $this->doPgsrcUpdate($pagename, $path, $filename); } } @@ -238,200 +239,6 @@ } /** - * TODO: Search table definition in appropriate schema - * and create it. - * Supported: mysql and generic SQL, for ADODB and PearDB. - */ - private function installTable($table, $backend_type) - { - global $DBParams; - if (!$this->isSQL) - return; - echo _("MISSING"), " ... \n"; - /* - $schema = findFile("schemas/${backend_type}.sql"); - if (!$schema) { - echo " ",_("FAILED"),": ",sprintf(_("no schema %s found"), - "schemas/${backend_type}.sql")," ... <br />\n"; - return false; - } - */ - extract($this->dbi->_backend->_table_names); - $prefix = isset($DBParams['prefix']) ? $DBParams['prefix'] : ''; - switch ($table) { - case 'session': - assert($session_tbl); - if ($backend_type == 'mysql') { - $this->dbi->genericSqlQuery(" -CREATE TABLE $session_tbl ( - sess_id CHAR(32) NOT NULL DEFAULT '', - sess_data BLOB NOT NULL, - sess_date INT UNSIGNED NOT NULL, - sess_ip CHAR(15) NOT NULL, - PRIMARY KEY (sess_id), - INDEX (sess_date) -)"); - } else { - $this->dbi->genericSqlQuery(" -CREATE TABLE $session_tbl ( - sess_id CHAR(32) NOT NULL DEFAULT '', - sess_data " . ($backend_type == 'pgsql' ? 'TEXT' : 'BLOB') . " NOT NULL, - sess_date INT, - sess_ip CHAR(15) NOT NULL -)"); - $this->dbi->genericSqlQuery("CREATE UNIQUE INDEX sess_id ON $session_tbl (sess_id)"); - } - $this->dbi->genericSqlQuery("CREATE INDEX sess_date on session (sess_date)"); - echo " ", _("CREATED"); - break; - case 'pref': - $pref_tbl = $prefix . 'pref'; - if ($backend_type == 'mysql') { - $this->dbi->genericSqlQuery(" -CREATE TABLE $pref_tbl ( - userid CHAR(48) BINARY NOT NULL UNIQUE, - prefs TEXT NULL DEFAULT '', - PRIMARY KEY (userid) -)"); - } else { - $this->dbi->genericSqlQuery(" -CREATE TABLE $pref_tbl ( - userid CHAR(48) NOT NULL, - prefs TEXT NULL DEFAULT '' -)"); - $this->dbi->genericSqlQuery("CREATE UNIQUE INDEX userid ON $pref_tbl (userid)"); - } - echo " ", _("CREATED"); - break; - case 'member': - $member_tbl = $prefix . 'member'; - if ($backend_type == 'mysql') { - $this->dbi->genericSqlQuery(" -CREATE TABLE $member_tbl ( - userid CHAR(48) BINARY NOT NULL, - groupname CHAR(48) BINARY NOT NULL DEFAULT 'users', - INDEX (userid), - INDEX (groupname) -)"); - } else { - $this->dbi->genericSqlQuery(" -CREATE TABLE $member_tbl ( - userid CHAR(48) NOT NULL, - groupname CHAR(48) NOT NULL DEFAULT 'users' -)"); - $this->dbi->genericSqlQuery("CREATE INDEX userid ON $member_tbl (userid)"); - $this->dbi->genericSqlQuery("CREATE INDEX groupname ON $member_tbl (groupname)"); - } - echo " ", _("CREATED"); - break; - case 'rating': - $rating_tbl = $prefix . 'rating'; - if ($backend_type == 'mysql') { - $this->dbi->genericSqlQuery(" -CREATE TABLE $rating_tbl ( - dimension INT(4) NOT NULL, - raterpage INT(11) NOT NULL, - rateepage INT(11) NOT NULL, - ratingvalue FLOAT NOT NULL, - rateeversion INT(11) NOT NULL, - tstamp TIMESTAMP(14) NOT NULL, - PRIMARY KEY (dimension, raterpage, rateepage) -)"); - } else { - $this->dbi->genericSqlQuery(" -CREATE TABLE $rating_tbl ( - dimension INT(4) NOT NULL, - raterpage INT(11) NOT NULL, - rateepage INT(11) NOT NULL, - ratingvalue FLOAT NOT NULL, - rateeversion INT(11) NOT NULL, - tstamp TIMESTAMP(14) NOT NULL -)"); - $this->dbi->genericSqlQuery("CREATE UNIQUE INDEX rating" - . " ON $rating_tbl (dimension, raterpage, rateepage)"); - } - echo " ", _("CREATED"); - break; - case 'accesslog': - $log_tbl = $prefix . 'accesslog'; - // fields according to http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/#id2756178 - /* - A User Agent agent varchar(255) Mozilla/4.0 (compat; MSIE 6.0; Windows) - a CGi request arguments request_args varchar(255) user=Smith&cart=1231&item=532 - b Bytes transfered bytes_sent int unsigned 32561 - c??? Text of cookie cookie varchar(255) Apache=sdyn.fooonline.net 1300102700823 - f Local filename requested request_file varchar(255) /var/www/html/books-cycroad.html - H HTTP request_protocol request_protocol varchar(10) HTTP/1.1 - h Name of remote host remote_host varchar(50) blah.foobar.com - I Request ID (from modd_unique_id) id char(19) POlFcUBRH30AAALdBG8 - l Ident user info remote_logname varcgar(50) bobby - M Machine ID??? machine_id varchar(25) web01 - m HTTP request method request_method varchar(10) GET - P httpd cchild PID child_pid smallint unsigned 3215 - p http port server_port smallint unsigned 80 - R Referer referer varchar(255) http://www.biglinks4u.com/linkpage.html - r Request in full form request_line varchar(255) GET /books-cycroad.html HTTP/1.1 - S Time of request in UNIX time_t format time_stamp int unsigned 1005598029 - T Seconds to service request request_duration smallint unsigned 2 - t Time of request in human format request_time char(28) [02/Dec/2001:15:01:26 -0800] - U Request in simple form request_uri varchar(255) /books-cycroad.html - u User info from HTTP auth remote_user varchar(50) bobby - v Virtual host servicing the request virtual_host varchar(255) - */ - $this->dbi->genericSqlQuery(" -CREATE TABLE $log_tbl ( - time_stamp int unsigned, - remote_host varchar(100), - remote_user varchar(50), - request_method varchar(10), - request_line varchar(255), - request_args varchar(255), - request_uri varchar(255), - request_time char(28), - status smallint unsigned, - bytes_sent smallint unsigned, - referer varchar(255), - agent varchar(255), - request_duration float -)"); - $this->dbi->genericSqlQuery("CREATE INDEX log_time ON $log_tbl (time_stamp)"); - $this->dbi->genericSqlQuery("CREATE INDEX log_host ON $log_tbl (remote_host)"); - echo " ", _("CREATED"); - break; - } - echo "<br />\n"; - } - - /** - * move _cached_html for all pages from pagedata into a new separate blob. - * decoupled from action=upgrade, so that it can be used by a WikiAdminUtils button also. - */ - private function _convert_cached_html() - { - if (!$this->isSQL) - return 0; - - $pages = $this->dbi->getAllPages(); - $cache =& $this->dbi->_cache; - $count = 0; - extract($this->dbi->_backend->_table_names); - while ($page = $pages->next()) { - $pagename = $page->getName(); - $data = $this->dbi->_backend->get_pagedata($pagename); - if (!empty($data['_cached_html'])) { - $cached_html = $data['_cached_html']; - $data['_cached_html'] = ''; - $cache->update_pagedata($pagename, $data); - // store as blob, not serialized - $this->dbi->genericSqlQuery("UPDATE $page_tbl SET cached_html=? WHERE pagename=?", - array($cached_html, $pagename)); - $count++; - } - } - return $count; - } - - /** * preg_replace over local file. * Only line-orientated matches possible. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |