选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
mDelegateManager->add( 'Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Success', 'xpwiki_message_append_onupdate' ) ; $root->mDelegateManager->add( 'Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Fail' , 'xpwiki_message_append_onupdate' ) ; $msgs = array() ; } else { if( ! is_array( $msgs ) ) $msgs = array() ; } $db =& Database::getInstance() ; $mid = $module->getVar('mid') ; // DB Check for db non support version $query = "SELECT * FROM ".$db->prefix($mydirname."_pginfo") ; if(! $db->query($query)) { // TABLES (loading mysql.sql) $sql_file_path = dirname(__FILE__).'/sql/mysql.sql' ; $prefix_mod = $db->prefix() . '_' . $mydirname ; if( file_exists( $sql_file_path ) ) { $ret[] = "SQL file found at ".htmlspecialchars($sql_file_path, ENT_COMPAT, _CHARSET).".
Creating tables..."; if( is_file( XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php' ) ) { include_once XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php' ; $sqlutil = new OldSqlUtility ; } else { include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php' ; $sqlutil = new SqlUtility ; } $sql_query = trim( file_get_contents( $sql_file_path ) ) ; $sqlutil->splitMySqlFile( $pieces , $sql_query ) ; $created_tables = array() ; foreach( $pieces as $piece ) { $prefixed_query = $sqlutil->prefixQuery( $piece , $prefix_mod ) ; if( ! $prefixed_query ) { $ret[] = "Invalid SQL ".htmlspecialchars($piece, ENT_COMPAT, _CHARSET)."
"; return false ; } if( ! $db->query( $prefixed_query[0] ) ) { $ret[] = ''.htmlspecialchars( $db->error(), ENT_COMPAT, _CHARSET ).'
' ; //var_dump( $db->error() ) ; return false ; } else { if( ! in_array( $prefixed_query[4] , $created_tables ) ) { $ret[] = 'Table '.htmlspecialchars($prefix_mod.'_'.$prefixed_query[4], ENT_COMPAT, _CHARSET).' created.
'; $created_tables[] = $prefixed_query[4]; } else { $ret[] = 'Data inserted to table '.htmlspecialchars($prefix_mod.'_'.$prefixed_query[4], ENT_COMPAT, _CHARSET).'.
'; } } } } } // TABLES (write here ALTER TABLE etc. if necessary) $query = "SELECT `reading` FROM ".$db->prefix($mydirname."_pginfo") ; if(! $db->query($query)) { $db->queryF('ALTER TABLE `'.$db->prefix($mydirname."_pginfo").'` ADD `reading` VARCHAR( 255 ) BINARY NOT NULL'); } $query = "SELECT `name_ci` FROM ".$db->prefix($mydirname."_pginfo") ; if(! $db->query($query)) { $db->query('ALTER TABLE `'.$db->prefix($mydirname.'_pginfo').'` ADD `name_ci` VARCHAR( 255 ) NOT NULL'); $db->query('ALTER TABLE `'.$db->prefix($mydirname.'_pginfo').'` ADD INDEX ( `name_ci` )'); $db->query('UPDATE `'.$db->prefix($mydirname.'_pginfo').'` SET `name_ci` = `name`'); } $query = "SELECT `pgorder` FROM ".$db->prefix($mydirname."_pginfo") ; if(! $db->query($query)) { $db->query('ALTER TABLE `'.$db->prefix($mydirname.'_pginfo').'` ADD `pgorder` FLOAT DEFAULT \'1\' NOT NULL'); } $query = "SELECT count(*) FROM ".$db->prefix($mydirname."_cache") ; if(! $db->query($query)) { $db->query( 'CREATE TABLE `'.$db->prefix($mydirname.'_cache').'` ( `key` varchar(64) NOT NULL default \'\', `plugin` varchar(100) NOT NULL default \'\', `data` mediumblob NOT NULL, `mtime` int(11) NOT NULL default \'0\', `ttl` int(11) NOT NULL default \'0\', KEY `key` (`key`), KEY `plugin` (`plugin`) ) ENGINE=MyISAM' ); } $query = "SELECT count(*) FROM ".$db->prefix($mydirname."_alias") ; if (! $db->query($query)) { $db->query( 'CREATE TABLE `'.$db->prefix($mydirname.'_alias').'` ( `name` varchar(255) binary NOT NULL DEFAULT \'\', `pgid` int(11) NOT NULL DEFAULT \'0\', PRIMARY KEY (`name`), KEY `pgid` (`pgid`) ) ENGINE=MyISAM' ); include_once XOOPS_TRUST_PATH."/modules/xpwiki/include.php"; $xpwiki = XpWiki::getInitedSingleton($mydirname); $xpwiki->init(); if ($xpwiki->root->page_aliases) { $query = array(); foreach($xpwiki->root->page_aliases as $alias => $page) { if ($pgid = $xpwiki->func->get_pgid_by_name($page)) { $query[] = '('.$db->quoteString($alias).','.$pgid.')'; } } if ($query) { $query = 'INSERT INTO `'.$db->prefix($mydirname."_alias").'` (`name`,`pgid`) VALUES '.join(',', $query); if ($db->query($query)) { $inifile = $xpwiki->cont['CACHE_DIR'] . 'pukiwiki.ini.php'; $ini = file_get_contents($inifile); file_put_contents($inifile.'.alias.bak', $ini); $ini = preg_replace('#//.+//\s+#s', '', $ini); file_put_contents($inifile, $ini); } } } unset($xpwiki); } // ADD Keys $table = $db->prefix($mydirname.'_attach'); if ($result = $db->query('SHOW INDEX FROM `' . $table . '`')) { $keys = array( 'name' => '', 'type' => '', 'mode' => '', 'age' => '' ); while($arr = $db->fetchArray($result)) { unset($keys[$arr['Key_name']]); } foreach ($keys as $_key => $_val) { $query = 'ALTER TABLE `' . $table . '` ADD INDEX(`'.$_key.'`'.$_val.')'; $db->query($query); //$msgs[] = $query; } } $table = $db->prefix($mydirname.'_pginfo'); if ($result = $db->query('SHOW INDEX FROM `' . $table . '`')) { $keys = array( 'editedtime' => '', 'freeze' => '', 'egids' => '', 'vgids' => '', 'eaids' => '(255)', 'vaids' => '(255)', 'vids' => array('vaids' => '(200)', 'vgids' => '(133)') ); while($arr = $db->fetchArray($result)) { unset($keys[$arr['Key_name']]); } foreach ($keys as $_key => $_val) { if (is_array($_val)) { $_index = array(); foreach($_val as $__key => $__val) { $_index[] = '`'.$__key.'`'.$__val; } $_index = join(', ', $_index); } else { $_index = '`'.$_key.'`'.$_val; } $query = 'ALTER TABLE `' . $table . '` ADD INDEX `'.$_key.'`('.$_index.')'; $db->query($query); //$msgs[] = $query; } } $table = $db->prefix($mydirname.'_rel'); if ($result = $db->query('SHOW INDEX FROM `' . $table . '`')) { $keys = array( 'PRIMARY' => '' ); while($arr = $db->fetchArray($result)) { unset($keys[$arr['Key_name']]); } if ($keys) { $dels = array(); $query = 'SELECT CONCAT(pgid, \'_\', relid) as id, (count(*)-1) as count FROM `'.$table.'` GROUP BY id HAVING count >= 1'; if ($result = $db->query($query)) { while($arr = $db->fetchRow($result)) { $dels[$arr[0]] = $arr[1]; } } foreach($dels as $key => $limit) { $arr = explode('_', $key); $query = 'DELETE FROM ' . $table . ' WHERE pgid='.$arr[0].' AND relid='.$arr[1].' LIMIT '.$limit; $db->query($query); //$msgs[] = $query; } $query = 'ALTER TABLE `' . $table . '` ADD PRIMARY KEY(`pgid`,`relid`)'; $db->query($query); //$msgs[] = $query; } } $table = $db->prefix($mydirname.'_count'); if ($result = $db->query('SHOW INDEX FROM `' . $table . '`')) { $keys = array( 'today' => '' ); while($arr = $db->fetchArray($result)) { unset($keys[$arr['Key_name']]); } foreach ($keys as $_key => $_val) { $query = 'ALTER TABLE `' . $table . '` ADD INDEX(`'.$_key.'`'.$_val.')'; $db->query($query); //$msgs[] = $query; } } // TEMPLATES (all templates have been already removed by modulesadmin) $tplfile_handler =& xoops_gethandler( 'tplfile' ) ; $tpl_path = dirname(__FILE__).'/templates' ; if( $handler = @opendir( $tpl_path . '/' ) ) { while( ( $file = readdir( $handler ) ) !== false ) { if( substr( $file , 0 , 1 ) == '.' ) continue ; $file_path = $tpl_path . '/' . $file ; if( is_file( $file_path ) && substr( $file , -5 ) == '.html' ) { $mtime = intval( @filemtime( $file_path ) ) ; $tplfile =& $tplfile_handler->create() ; $tplfile->setVar( 'tpl_source' , file_get_contents( $file_path ) , true ) ; $tplfile->setVar( 'tpl_refid' , $mid ) ; $tplfile->setVar( 'tpl_tplset' , 'default' ) ; $tplfile->setVar( 'tpl_file' , $mydirname . '_' . $file ) ; $tplfile->setVar( 'tpl_desc' , '' , true ) ; $tplfile->setVar( 'tpl_module' , $mydirname ) ; $tplfile->setVar( 'tpl_lastmodified' , $mtime ) ; $tplfile->setVar( 'tpl_lastimported' , 0 ) ; $tplfile->setVar( 'tpl_type' , 'module' ) ; if( ! $tplfile_handler->insert( $tplfile ) ) { $msgs[] = 'ERROR: Could not insert template '.htmlspecialchars($mydirname.'_'.$file, ENT_COMPAT, _CHARSET).' to the database.'; } else { $tplid = $tplfile->getVar( 'tpl_id' ) ; $msgs[] = 'Template '.htmlspecialchars($mydirname.'_'.$file, ENT_COMPAT, _CHARSET).' added to the database. (ID: '.$tplid.')'; // generate compiled file include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; include_once XOOPS_ROOT_PATH.'/class/template.php' ; if( ! xoops_template_touch( $tplid ) ) { $msgs[] = 'ERROR: Failed compiling template '.htmlspecialchars($mydirname.'_'.$file, ENT_COMPAT, _CHARSET).'.'; } else { $msgs[] = 'Template '.htmlspecialchars($mydirname.'_'.$file, ENT_COMPAT, _CHARSET).' compiled.'; } } } } closedir( $handler ) ; } include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ; include_once XOOPS_ROOT_PATH.'/class/template.php' ; xoops_template_clear_module_cache( $mid ) ; // xpWiki original functions include_once dirname(__FILE__).'/include/check.func.php'; $_ret = xpwikifunc_permission_check($mydirname); if (!$_ret) { $msgs = array_merge($msgs, xpwikifunc_defdata_check($mydirname, 'update')); } else { $msgs = array_merge($msgs, $_ret); return false; } // Delete COUNTER_DIR/*.counter $msgs = array_merge($msgs, xpwikifunc_delete_counter($mydirname)); return true ; } function xpwiki_message_append_onupdate( &$module_obj , &$log ) { if( is_array( @$GLOBALS['msgs'] ) ) { foreach( $GLOBALS['msgs'] as $message ) { $log->add( strip_tags( $message ) ) ; } } // use mLog->addWarning() or mLog->addError() if necessary } } ?>