当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik::getTablesInstalled方法代码示例

本文整理汇总了PHP中Piwik::getTablesInstalled方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::getTablesInstalled方法的具体用法?PHP Piwik::getTablesInstalled怎么用?PHP Piwik::getTablesInstalled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik的用法示例。


在下文中一共展示了Piwik::getTablesInstalled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

	static function update()
	{
		$sqlarray = array(
			'ALTER TABLE `'. Piwik::prefixTable('log_visit') .'`
				ADD `visit_goal_converted` VARCHAR( 1 ) NOT NULL AFTER `visit_total_time`' => false,
			// 0.2.27 [826]
			'ALTER IGNORE TABLE `'. Piwik::prefixTable('log_visit') .'`
				CHANGE `visit_goal_converted` `visit_goal_converted` TINYINT(1) NOT NULL' => false,
		);

		$tables = Piwik::getTablesCreateSql();
		$sqlarray[ $tables['log_conversion'] ] = false;
		$sqlarray[ $tables['goal'] ] = false;

		$tables = Piwik::getTablesInstalled();
		foreach($tables as $tableName)
		{
			if(preg_match('/archive_/', $tableName) == 1)
			{
				$sqlarray[ 'CREATE INDEX index_all ON '. $tableName .' (`idsite`,`date1`,`date2`,`name`,`ts_archived`)' ] = false;
			}
		}

		Piwik_Updater::updateDatabase(__FILE__, $sqlarray);
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:25,代码来源:0.2.27.php

示例2: getSql

    static function getSql($schema = 'Myisam')
    {
        $sqlarray = array('ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '`
				ADD `visit_goal_converted` VARCHAR( 1 ) NOT NULL AFTER `visit_total_time`' => false, 'ALTER IGNORE TABLE `' . Piwik_Common::prefixTable('log_visit') . '`
				CHANGE `visit_goal_converted` `visit_goal_converted` TINYINT(1) NOT NULL' => false, 'CREATE TABLE `' . Piwik_Common::prefixTable('goal') . "` (\n\t\t\t\t`idsite` int(11) NOT NULL,\n\t\t\t\t`idgoal` int(11) NOT NULL,\n\t\t\t\t`name` varchar(50) NOT NULL,\n\t\t\t\t`match_attribute` varchar(20) NOT NULL,\n\t\t\t\t`pattern` varchar(255) NOT NULL,\n\t\t\t\t`pattern_type` varchar(10) NOT NULL,\n\t\t\t\t`case_sensitive` tinyint(4) NOT NULL,\n\t\t\t\t`revenue` float NOT NULL,\n\t\t\t\t`deleted` tinyint(4) NOT NULL default '0',\n\t\t\t\tPRIMARY KEY  (`idsite`,`idgoal`)\n\t\t\t)" => false, 'CREATE TABLE `' . Piwik_Common::prefixTable('log_conversion') . '` (
				`idvisit` int(10) unsigned NOT NULL,
				`idsite` int(10) unsigned NOT NULL,
				`visitor_idcookie` char(32) NOT NULL,
				`server_time` datetime NOT NULL,
				`visit_server_date` date NOT NULL,
				`idaction` int(11) NOT NULL,
				`idlink_va` int(11) NOT NULL,
				`referer_idvisit` int(10) unsigned default NULL,
				`referer_visit_server_date` date default NULL,
				`referer_type` int(10) unsigned default NULL,
				`referer_name` varchar(70) default NULL,
				`referer_keyword` varchar(255) default NULL,
				`visitor_returning` tinyint(1) NOT NULL,
				`location_country` char(3) NOT NULL,
				`location_continent` char(3) NOT NULL,
				`url` text NOT NULL,
				`idgoal` int(10) unsigned NOT NULL,
				`revenue` float default NULL,
				PRIMARY KEY  (`idvisit`,`idgoal`),
				KEY `index_idsite_date` (`idsite`,`visit_server_date`)
			)' => false);
        $tables = Piwik::getTablesInstalled();
        foreach ($tables as $tableName) {
            if (preg_match('/archive_/', $tableName) == 1) {
                $sqlarray['CREATE INDEX index_all ON ' . $tableName . ' (`idsite`,`date1`,`date2`,`name`,`ts_archived`)'] = false;
            }
        }
        return $sqlarray;
    }
开发者ID:nnnnathann,项目名称:piwik,代码行数:34,代码来源:0.2.27.php

示例3: checkTableExists

	protected function checkTableExists()
	{
		if(is_null(self::$tablesAlreadyInstalled))
		{
			self::$tablesAlreadyInstalled = Piwik::getTablesInstalled($forceReload = false);
		}
		
		if(!in_array($this->generatedTableName, self::$tablesAlreadyInstalled))
		{
			$db = Zend_Registry::get('db');
			$sql = Piwik::getTableCreateSql($this->tableName);
			
			$config = Zend_Registry::get('config');
			$prefixTables = $config->database->tables_prefix;
			$sql = str_replace( $prefixTables . $this->tableName, $this->generatedTableName, $sql);
			try {
				$db->query( $sql );
			} catch(Exception $e) {
				// mysql error 1050: table already exists
				if(! $db->isErrNo($e, '1050'))
				{
					// failed for some other reason
					throw $e;
				}
			}
			
			self::$tablesAlreadyInstalled[] = $this->generatedTableName;
		}
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:29,代码来源:TablePartitioning.php

示例4: getAllTablesStatus

 public static function getAllTablesStatus()
 {
     Piwik::checkUserIsSuperUser();
     $db = Zend_Registry::get('db');
     // http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html
     $tablesPiwik = Piwik::getTablesInstalled();
     $total = array('Name' => 'Total', 'Data_length' => 0, 'Index_length' => 0, 'Rows' => 0);
     $table = array();
     foreach ($tablesPiwik as $tableName) {
         $t = self::getTableStatus($tableName);
         $total['Data_length'] += $t['Data_length'];
         $total['Index_length'] += $t['Index_length'];
         $total['Rows'] += $t['Rows'];
         $t['Total_length'] = Piwik::getPrettySizeFromBytes($t['Index_length'] + $t['Data_length']);
         $t['Data_length'] = Piwik::getPrettySizeFromBytes($t['Data_length']);
         $t['Index_length'] = Piwik::getPrettySizeFromBytes($t['Index_length']);
         $t['Rows'] = Piwik::getPrettySizeFromBytes($t['Rows']);
         $table[] = $t;
     }
     $total['Total_length'] = Piwik::getPrettySizeFromBytes($total['Data_length'] + $total['Index_length']);
     $total['Data_length'] = Piwik::getPrettySizeFromBytes($total['Data_length']);
     $total['Index_length'] = Piwik::getPrettySizeFromBytes($total['Index_length']);
     $total['TotalRows'] = Piwik::getPrettySizeFromBytes($total['Rows']);
     $table['Total'] = $total;
     return $table;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:26,代码来源:API.php

示例5: update

    static function update()
    {
        // alter table to set the utf8 collation
        $tablesToAlter = Piwik::getTablesInstalled(true);
        foreach ($tablesToAlter as $table) {
            $sqlarray['ALTER TABLE `' . $table . '`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci '] = false;
        }
        Piwik_Updater::updateDatabase(__FILE__, $sqlarray);
    }
开发者ID:ntulip,项目名称:piwik,代码行数:10,代码来源:0.2.33.php

示例6: optimizeArchiveTable

 function optimizeArchiveTable()
 {
     $tablesPiwik = Piwik::getTablesInstalled();
     $archiveTables = array_filter($tablesPiwik, array("Piwik_CoreAdminHome", "isArchiveTable"));
     if (empty($archiveTables)) {
         return;
     }
     $query = "OPTIMIZE TABLE " . implode(",", $archiveTables);
     Piwik_Query($query);
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:10,代码来源:CoreAdminHome.php

示例7: getSql

    static function getSql($schema = 'Myisam')
    {
        $sqlarray = array('ALTER TABLE `' . Piwik_Common::prefixTable('user_dashboard') . '`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146', 'ALTER TABLE `' . Piwik_Common::prefixTable('user_language') . '`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146');
        // alter table to set the utf8 collation
        $tablesToAlter = Piwik::getTablesInstalled(true);
        foreach ($tablesToAlter as $table) {
            $sqlarray['ALTER TABLE `' . $table . '`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci '] = false;
        }
        return $sqlarray;
    }
开发者ID:nnnnathann,项目名称:piwik,代码行数:13,代码来源:0.2.33.php

示例8: testDailyPartition

 /**
  * test daily
  * @group Core
  * @group TablePartitioning
  */
 public function testDailyPartition()
 {
     $tableName = 'archive_numeric';
     $p = new Piwik_TablePartitioning_Daily($tableName);
     $timestamp = strtotime("10 September 2000");
     $suffixShouldBe = "_2000_09_10";
     $prefixTables = Piwik_Config::getInstance()->database['tables_prefix'];
     $tablename = $prefixTables . $tableName . $suffixShouldBe;
     $p->setTimestamp($timestamp);
     $allTablesInstalled = Piwik::getTablesInstalled();
     $this->assertContains($tablename, $allTablesInstalled);
     $this->assertEquals($tablename, $p->getTableName());
     $this->assertEquals($tablename, (string) $p->__toString());
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:19,代码来源:TablePartitioningTest.php

示例9: getSql

 static function getSql()
 {
     $sqlarray = array('DROP INDEX index_idsite_date ON ' . Piwik::prefixTable('log_visit') => '1091', 'CREATE INDEX index_idsite_date_config ON ' . Piwik::prefixTable('log_visit') . ' (idsite, visit_server_date, config_md5config(8))' => '1061');
     $tables = Piwik::getTablesInstalled();
     foreach ($tables as $tableName) {
         if (preg_match('/archive_/', $tableName) == 1) {
             $sqlarray['DROP INDEX index_all ON ' . $tableName] = '1091';
         }
         if (preg_match('/archive_numeric_/', $tableName) == 1) {
             $sqlarray['CREATE INDEX index_idsite_dates_period ON ' . $tableName . ' (idsite, date1, date2, period)'] = '1061';
         }
     }
     return $sqlarray;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:14,代码来源:0.5.5.php

示例10: checkTableExists

 protected function checkTableExists()
 {
     if (is_null(self::$tablesAlreadyInstalled)) {
         self::$tablesAlreadyInstalled = Piwik::getTablesInstalled($forceReload = false);
     }
     if (!in_array($this->generatedTableName, self::$tablesAlreadyInstalled)) {
         $db = Zend_Registry::get('db');
         $sql = Piwik::getTableCreateSql($this->tableName);
         $config = Zend_Registry::get('config');
         $prefixTables = $config->database->tables_prefix;
         $sql = str_replace($prefixTables . $this->tableName, $this->generatedTableName, $sql);
         $db->query($sql);
         self::$tablesAlreadyInstalled[] = $this->generatedTableName;
     }
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:15,代码来源:TablePartitioning.php

示例11: test_dailyPartition

 function test_dailyPartition()
 {
     $tableName = 'archive_numeric';
     $p = new Piwik_TablePartitioning_Daily($tableName);
     $timestamp = strtotime("10 September 2000");
     $suffixShouldBe = "_2000_09_10";
     $config = Zend_Registry::get('config');
     $prefixTables = $config->database->tables_prefix;
     $tablename = $prefixTables . $tableName . $suffixShouldBe;
     $p->setTimestamp($timestamp);
     $allTablesInstalled = Piwik::getTablesInstalled();
     $this->assertTrue(in_array($tablename, $allTablesInstalled));
     $this->assertTrue($tablename, $p->getTableName());
     $this->assertEqual($tablename, (string) $p);
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:15,代码来源:TablePartitioning.test.php

示例12: getSql

    static function getSql($schema = 'Myisam')
    {
        $sqlarray = array('ALTER TABLE `' . Piwik_Common::prefixTable('log_visit') . '`
				ADD `visit_goal_converted` VARCHAR( 1 ) NOT NULL AFTER `visit_total_time`' => false, 'ALTER IGNORE TABLE `' . Piwik_Common::prefixTable('log_visit') . '`
				CHANGE `visit_goal_converted` `visit_goal_converted` TINYINT(1) NOT NULL' => false);
        $tables = Piwik::getTablesCreateSql();
        $sqlarray[$tables['log_conversion']] = false;
        $sqlarray[$tables['goal']] = false;
        $tables = Piwik::getTablesInstalled();
        foreach ($tables as $tableName) {
            if (preg_match('/archive_/', $tableName) == 1) {
                $sqlarray['CREATE INDEX index_all ON ' . $tableName . ' (`idsite`,`date1`,`date2`,`name`,`ts_archived`)'] = false;
            }
        }
        return $sqlarray;
    }
开发者ID:Gninety,项目名称:Microweber,代码行数:16,代码来源:0.2.27.php

示例13: tearDown

 public function tearDown()
 {
     parent::tearDown();
     Piwik::$lockPrivilegeGranted = null;
     // remove archive tables (integration test teardown will only truncate)
     $archiveTables = $this->getArchiveTableNames();
     $archiveTables = array_merge($archiveTables['numeric'], $archiveTables['blob']);
     foreach ($archiveTables as $table) {
         Piwik_Query("DROP TABLE IF EXISTS " . Piwik_Common::prefixTable($table));
     }
     // refresh table name caches so next test will pass
     Piwik_TablePartitioning::$tablesAlreadyInstalled = null;
     Piwik::getTablesInstalled(true);
     // drop temporary tables
     $tempTableName = Piwik_PrivacyManager_LogDataPurger::TEMP_TABLE_NAME;
     Piwik_Query("DROP TABLE IF EXISTS " . Piwik_Common::prefixTable($tempTableName));
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:17,代码来源:PrivacyManager.test.php

示例14: update

	static function update()
	{
		$sqlarray = array(
			// 0.2.33 [1020]
			'ALTER TABLE `'. Piwik::prefixTable('user_dashboard') .'`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146',
			'ALTER TABLE `'. Piwik::prefixTable('user_language') .'`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' => '1146',
		);

		// alter table to set the utf8 collation
		$tablesToAlter = Piwik::getTablesInstalled(true);
		foreach($tablesToAlter as $table) {
			$sqlarray[ 'ALTER TABLE `'. $table .'`
				CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci ' ] = false;
		}

		Piwik_Updater::updateDatabase(__FILE__, $sqlarray);
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:19,代码来源:0.2.33.php

示例15: getAllTablesStatus

 /**
  * Gets the result of a SHOW TABLE STATUS query for every Piwik table in the DB.
  * Non-piwik tables are ignored.
  * 
  * @param string $matchingRegex Regex used to filter out tables whose name doesn't
  *                              match it.
  * @return array The table information. See http://dev.mysql.com/doc/refman/5.5/en/show-table-status.html
  *               for specifics.
  */
 public function getAllTablesStatus($matchingRegex = null)
 {
     if (is_null($this->tableStatuses)) {
         $tablesPiwik = Piwik::getTablesInstalled();
         $this->tableStatuses = array();
         foreach (Piwik_FetchAll("SHOW TABLE STATUS") as $t) {
             if (in_array($t['Name'], $tablesPiwik)) {
                 $this->tableStatuses[$t['Name']] = $t;
             }
         }
     }
     if (is_null($matchingRegex)) {
         return $this->tableStatuses;
     }
     $result = array();
     foreach ($this->tableStatuses as $status) {
         if (preg_match($matchingRegex, $status['Name'])) {
             $result[] = $status;
         }
     }
     return $result;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:31,代码来源:MySQLMetadataProvider.php


注:本文中的Piwik::getTablesInstalled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。