From db52f1cfcf28fa187ce434e5cd99848f1e7e8f63 Mon Sep 17 00:00:00 2001
From: James <james@sourcefabric-DX4840.(none)>
Date: Mon, 17 Sep 2012 17:47:32 -0400
Subject: [PATCH] CC-4383: Fatal error in phone_home_stat script (2.2.0 dev)

- fixed
---
 utils/phone_home_stat.php | 37 +++++++++++--------------------------
 1 file changed, 11 insertions(+), 26 deletions(-)

diff --git a/utils/phone_home_stat.php b/utils/phone_home_stat.php
index d01a736c1..47929f5f7 100644
--- a/utils/phone_home_stat.php
+++ b/utils/phone_home_stat.php
@@ -35,23 +35,21 @@ get_include_path(),
 realpath($CC_CONFIG['phpDir'] . '/library')
 )));
 
-function __autoload($classname){
+function my_autoload($classname){
     global $CC_CONFIG;
     $info = explode('_', $classname);
-    if (isset($info[2])) {
+    if (isset($info[1]) && isset($info[2])) {
         $filename = $info[2].".php";
-        require_once($CC_CONFIG['phpDir'].'/application/models/'.$filename);
+        if ($info[1] == "Model") {
+            $folderName = "models";
+        } else if ($info[1] == "Common") {
+            $folderName = "common";
+        }
+        require_once($CC_CONFIG['phpDir'].'/application/'.$folderName.'/'.$filename);
     }
 }
-require_once($CC_CONFIG['phpDir'].'/application/models/User.php');
-require_once($CC_CONFIG['phpDir'].'/application/models/StoredFile.php');
-require_once($CC_CONFIG['phpDir'].'/application/models/Playlist.php');
-require_once($CC_CONFIG['phpDir'].'/application/models/Schedule.php');
-require_once($CC_CONFIG['phpDir'].'/application/models/Show.php');
-require_once($CC_CONFIG['phpDir'].'/application/models/ShowInstance.php');
-require_once($CC_CONFIG['phpDir'].'/application/models/Preference.php');
-require_once($CC_CONFIG['phpDir'].'/application/models/StreamSetting.php');
-require_once($CC_CONFIG['phpDir'].'/application/models/LiveLog.php');
+
+spl_autoload_register('my_autoload');
 
 require_once 'propel/runtime/lib/Propel.php';
 Propel::init($CC_CONFIG['phpDir']."/application/configs/airtime-conf-production.php");
@@ -64,20 +62,7 @@ if (file_exists('/usr/share/php/libzend-framework-php')){
 require_once('Zend/Loader/Autoloader.php');
 $autoloader = Zend_Loader_Autoloader::getInstance();
 
-try {
-    $opts = new Zend_Console_Getopt(
-    array(
-            'test|t' => "Keep broadcast log data\n"
-            )
-            );
-            $opts->parse();
-}
-catch (Zend_Console_Getopt_Exception $e) {
-    print $e->getMessage() .PHP_EOL;
-    exit(1);
-}
-
-$infoArray = Application_Model_Preference::GetSystemInfo(true, isset($opts->t));
+$infoArray = Application_Model_Preference::GetSystemInfo(true);
 
 if(Application_Model_Preference::GetSupportFeedback() == '1'){
     $url = 'http://stat.sourcefabric.org/index.php?p=airtime';