]> git.mjollnir.org Git - s9y.git/commitdiff
- Use local PEAR by default
authorgarvinhicking <garvinhicking>
Fri, 9 Jun 2006 08:51:42 +0000 (08:51 +0000)
committergarvinhicking <garvinhicking>
Fri, 9 Jun 2006 08:51:42 +0000 (08:51 +0000)
- Add missing DB indices for visitor table

docs/NEWS
plugins/serendipity_event_statistics/serendipity_event_statistics.php
serendipity_config.inc.php

index d1fe6aa6cf39b12a7519fcf203bc33b745939727..54d4139279043338012131013f05df2b3383fce2 100644 (file)
--- 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
index 2534b1a8135a90d357a54de7a3cfd62801552223..64960a28d87e491e7f199997a0f6bbeea8978d80 100644 (file)
@@ -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()
 
 
index 7137d325d73f4b5c53a2b77a6be893e8e62d3d5c..99c6f071159374e85cc2e6b1f25dcb029fe3b73d 100644 (file)
@@ -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'];