public static function boot()
 {
     require BASE_PATH . '/vendor/autoload.php';
     $capsule = new Capsule();
     $capsule->addConnection(Config::get('database.connections.' . Config::get('database.default')));
     $capsule->bootEloquent();
 }
}
// Start the process
// check if we are running from command line
if (isset($argc) && $argc > 0) {
    \library\traits\Loging::inCron();
}
if (isset($env) && strtoupper($env) == 'TESTING') {
    define('APPLICATION_ENVIRONMENT', 'TESTING');
    error_reporting(E_ALL);
} else {
    // Production
    define('APPLICATION_ENVIRONMENT', 'PRODUCTION');
    error_reporting(E_STRICT);
}
// load configuration file
$config = \library\Config::getConfigArray($basePath . 'application/default/config/config.ini', APPLICATION_ENVIRONMENT);
$logDir = $config['logDir'];
if (!is_dir($logDir)) {
    mkdir($logDir);
}
$log = isset($log) && !empty($log) ? $log : $logDir . '/eventCrunch.' . date('Ymd', strtotime('now')) . '.log';
$awsAccessKey = $config['awsAccessKey'];
$awsSecretAccessKey = $config['awsSecretAccessKey'];
$kissmetricsBucket = $config['kissmetricsBucket'];
// ready to run
echo "using log: {$log}";
\library\traits\Loging::setLog($log);
\library\traits\Loging::printTime("Status: starting up eventsCrunch.php " . date('Y-m-d H:i:s', strtotime('now')));
// The gear - load database and run
$db = \library\Db::getInstance($config['dbserver'], $config['dbname']);
if (!$db->connect($config['dbserver'], $config['dbuser'], $config['dbpass'], $config['dbname'], true)) {
Exemple #3
0
 /**
  * Models a collection media object for media feeds
  *
  * @param type $mediaObject
  * @param type $mediaObjectType
  * @param type $mediaObjectId
  *
  * return void;
  */
 public static function mediaObject(&$mediaObject, $attachment)
 {
     //Allowed media objects
     $types = \Library\Config::getParam("allowed-types", array(), "attachments");
     //1.Load the collection!
     if (!is_object($attachment) && is_a($attachment, 'Platform\\Entity')) {
         $thisModel = new Self();
         $attachment = $thisModel->loadObjectByURI($attachment);
     }
     //If the media object is not a collection! skip it
     $objectTypeshaystack = array("attachment");
     if (!in_array($attachment->getObjectType(), $objectTypeshaystack)) {
         return;
     }
     //Nothing to do here if we can't deal with it!
     $attachmentObject = new MediaLink();
     //2.Get all the elements in the collection, limit 5 if more than 5
     //3.Trigger their timeline display
     $mediaObjectURI = $attachment->getObjectURI();
     $attachmentObject::set("objectType", "attachment");
     $attachmentObject::set("uri", $attachment->getObjectURI());
     //Now lets populate our collection with Items
     //@TODO Will probably need to query for objectType of items in collection?
     //@TODO Also this will help in removing objects from collections that have previously been deleted
     $attachmentObjectURL = !empty($mediaObjectURI) ? "/system/object/{$mediaObjectURI}" : "http://placeskull.com/100/100/999999";
     $attachmentObject->set("url", $attachmentObjectURL);
     $attachmentObject->set("uri", $mediaObjectURI);
     //AttachmentTypes
     //$mediaType  =  $attachment->getPropertyValue("attachment_type");
     $attachmentObject->set("name", $attachment->getPropertyValue("attachment_name"));
     $attachmentObject->set("type", $attachment->getPropertyValue("attachment_type"));
     $attachmentObject->set("height", null);
     $attachmentObject->set("width", null);
     //echo $mediaObjectURI;
     //Now set the collection Object as the media Object
     $mediaObject = $attachmentObject;
     return true;
 }
Exemple #4
0
 private static function initConfig()
 {
     App::$inst->container->singleton('config', function () {
         return \Library\Config::getConfig();
     });
 }