From c42531b120986da9fcf32bbcef551ca58c180bb6 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Fri, 9 Jun 2006 08:51:42 +0000 Subject: [PATCH] - Use local PEAR by default - Add missing DB indices for visitor table --- docs/NEWS | 6 +++ .../serendipity_event_statistics.php | 12 +++++- serendipity_config.inc.php | 40 +++++++++++++------ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index d1fe6aa..54d4139 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,12 @@ Version 1.1-alpha6() ------------------------------------------------------------------------ + * Use possibly existing local PEAR by default. Patch by Davey + (garvinhicking) + + * Add missing indices for the statistics visitor DB tables + (garvinhicking) + * Add new "custom" property bag type, which can emit any kind of custom HTML/JS values. Current property bag value can be referenced by DOM GetElementById('config_plugin_XXX') if you want to emit diff --git a/plugins/serendipity_event_statistics/serendipity_event_statistics.php b/plugins/serendipity_event_statistics/serendipity_event_statistics.php index 2534b1a..64960a2 100644 --- a/plugins/serendipity_event_statistics/serendipity_event_statistics.php +++ b/plugins/serendipity_event_statistics/serendipity_event_statistics.php @@ -20,7 +20,7 @@ class serendipity_event_statistics extends serendipity_event $propbag->add('description', PLUGIN_EVENT_STATISTICS_DESC); $propbag->add('stackable', false); $propbag->add('author', 'Arnan de Gans, Garvin Hicking, Fredrik Sandberg'); - $propbag->add('version', '1.41'); + $propbag->add('version', '1.42'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', @@ -914,6 +914,16 @@ class serendipity_event_statistics extends serendipity_event )"; serendipity_db_schema_import($q); + //create indices + $q = "CREATE INDEX visitorses ON {$serendipity['dbPrefix']}visitors(sessID);"; + serendipity_db_schema_import($q); + $q = "CREATE INDEX visitorday ON {$serendipity['dbPrefix']}visitors(day);"; + serendipity_db_schema_import($q); + $q = "CREATE INDEX visitortime ON {$serendipity['dbPrefix']}visitors(time);"; + serendipity_db_schema_import($q); + $q = "CREATE INDEX visitortime ON {$serendipity['dbPrefix']}visitors_count(year, month, day);"; + serendipity_db_schema_import($q); + } //end of function createTables() diff --git a/serendipity_config.inc.php b/serendipity_config.inc.php index 7137d32..99c6f07 100644 --- a/serendipity_config.inc.php +++ b/serendipity_config.inc.php @@ -71,14 +71,14 @@ if (!isset($serendipity['RSSfetchLimit'])) { $serendipity['RSSfetchLimit'] = 15; } -if (!isset($serendipity['use_PEAR'])) { - $serendipity['use_PEAR'] = false; -} - if (!isset($serendipity['mediaProperties'])) { $serendipity['mediaProperties'] = 'DPI;COPYRIGHT;TITLE;COMMENT1:MULTI;COMMENT2:MULTI'; } +if (!isset($serendipity['use_PEAR'])) { + $serendipity['use_PEAR'] = true; +} + // Should IFRAMEs be used for previewing entries and sending trackbacks? $serendipity['use_iframe'] = true; @@ -146,19 +146,35 @@ if ( !defined('IN_installer') && IS_installed === false ) { serendipity_die(sprintf(SERENDIPITY_NOT_INSTALLED, 'serendipity_admin.php')); } -// Check whether local or global PEAR should be used. You can put a -// $serendipity['use_PEAR'] = true; -// in your serendipity_config_local.inc.php file to enable this. -// The required PEAR (and other) packages are mentioned in the file -// bundled-libs/.current_version -$old_include = @ini_get('include_path'); -if (@ini_set('include_path', $old_include . PATH_SEPARATOR . $serendipity['serendipityPath'] . PATH_SEPARATOR . $serendipity['serendipityPath'] . 'bundled-libs/') && $serendipity['use_PEAR']) { - @define('S9Y_PEAR', true); +/* Do the PEAR dance. If $serendipity['use_PEAR'] is set to FALSE, Serendipity will first put its own PEAR include path. + By default, a local PEAR will be used. */ +if (function_exists('get_include_path')) { + $old_include = @get_include_path('include_path'); +} else { + $old_include = @ini_get('include_path'); +} + + +$new_include = ($serendipity['use_PEAR'] ? $old_include . PATH_SEPARATOR : '') + . S9Y_INCLUDE_PATH . 'bundled-libs/' . PATH_SEPARATOR + . S9Y_INCLUDE_PATH . 'bundled-libs/Smarty/libs/' . PATH_SEPARATOR + . $serendipity['serendipityPath'] . PATH_SEPARATOR + . (!$serendipity['use_PEAR'] ? $old_include . PATH_SEPARATOR : ''); + +if (function_exists('set_include_path')) { + $use_include = @set_include_path($new_include); +} else { + $use_include = @ini_set('include_path', $new_include); +} + +if ($use_include) { + @define('S9Y_PEAR', true); @define('S9Y_PEAR_PATH', ''); } else { @define('S9Y_PEAR', false); @define('S9Y_PEAR_PATH', S9Y_INCLUDE_PATH . 'bundled-libs/'); } +/* PEAR path setup inclusion finished */ if (defined('IN_installer') && IS_installed === false) { $serendipity['lang'] = $serendipity['autolang']; -- 2.39.5