From: Domas Mituzas Date: Fri, 11 Jun 2004 14:37:57 +0000 (+0000) Subject: title length code fixup (get rid of SHOW COLUMNS FROM for nonmysql) X-Git-Tag: 1.5.0alpha1~2923 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=74d781db2e02e6084507b5c704f758c75ce97e45;p=lhc%2Fweb%2Fwiklou.git title length code fixup (get rid of SHOW COLUMNS FROM for nonmysql) --- diff --git a/includes/Title.php b/includes/Title.php index a4766e500e..cba6d53c6f 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -88,7 +88,7 @@ class Title { # From a URL-encoded title /* static */ function newFromURL( $url ) { - global $wgLang, $wgServer; + global $wgLang, $wgServer, $wgIsMySQL, $wgIsPg; $t = new Title(); # For compatibility with old buggy URLs. "+" is not valid in titles, @@ -109,14 +109,20 @@ class Title { $t->mDbkeyform = str_replace( " ", "_", $s ); if( $t->secureAndSplit() ) { - # check that lenght of title is < cur_title size - $sql = "SHOW COLUMNS FROM cur LIKE \"cur_title\";"; - $cur_title_object = wfFetchObject(wfQuery( $sql, DB_READ )); + if ($wgIsMySQL) { + $sql = "SHOW COLUMNS FROM cur LIKE \"cur_title\";"; + $cur_title_object = wfFetchObject(wfQuery( $sql, DB_READ )); - preg_match( "/\((.*)\)/", $cur_title_object->Type, $cur_title_size); + preg_match( "/\((.*)\)/", $cur_title_object->Type, $cur_title_type); + $cur_title_size=$cur_title_type[1]; + } else { + /* midom:FIXME pg_field_type does not return varchar length + assume 255 */ + $cur_title_size=255; + } - if (strlen($t->mDbkeyform) > $cur_title_size[1] ) { + if (strlen($t->mDbkeyform) > $cur_title_size ) { return NULL; }