Exemplo n.º 1
0
 /**
  * @param Spider\Connection\Connection
  * @param Spider\Component\Config
  */
 public function __construct(Connection $Connection, Config $Config = null)
 {
     $this->Config = is_null($Config) ? new Config() : $Config;
     $this->Config->connection($Connection);
     $this->Logger = Logger::instance($Config->getTrace());
     $this->Nest = new Nest($this->Config);
 }
Exemplo n.º 2
0
namespace Spider\bin;

use Spider\Connection;
use Spider\Component\Logger;
/**
 * Command line script 
 *
 * @package Nest
 * @author  Jesse Cascio <*****@*****.**>
 * @see     jessesnet.com
 */
error_reporting(E_ALL);
require __DIR__ . "/../../../../../autoload.php";
$opts = getopt("q:m:t:k:c:s:f:");
ini_set("memory_limit", intval($opts['m']) . "M");
$Logger = Logger::instance(base64_decode($opts['f']));
// grab the connection params
try {
    $conn = json_decode(base64_decode($opts['c']), true);
    $pdo = new Connection\MySQL($conn['db'], $conn['usr'], $conn['pwd'], $conn['hst'], $conn['prt']);
} catch (\Exception $e) {
    $Logger->addError('Error With Connection', [$e->getMessage()]);
    die;
}
// grab the query
try {
    $query = base64_decode($opts['q']);
    $result = $pdo->query($query);
} catch (\Exception $e) {
    $Logger->addError('Error With Query', [$e->getMessage()]);
    die;