public function indexAction() { // TBD // List all objects? $pheanstalkClassRoot = APPLICATION_PATH . '/../contrib/Pheanstalk'; require_once $pheanstalkClassRoot . '/Pheanstalk/ClassLoader.php'; Pheanstalk_ClassLoader::register($pheanstalkClassRoot); $pheanstalk = new Pheanstalk('nurgle.nl'); $id = $pheanstalk->usetube('testtube')->put('stop'); print $id; exit; /* while($job = $pheanstalk->watch('testtube')->ignore('default')->reserve()) { echo " -- " . $job->getData() . "\n"; $pheanstalk->delete($job); } */ exit; /* $this->getResponse()->setHttpResponseCode(400); $data = array( 'code' => self::ERRNO_NO_ID, 'message' => self::ERRMSG_NO_ID, ); $this->_helper->json($data); */ }
/** * Registers Pheanstalk_ClassLoader as an SPL class loader. * Inserts self first, retains existing loaders and __autoload() * * @param string $path Path to Pheanstalk classes directory */ public static function register($path) { self::$_path = $path; self::addPath($path); if ($loaders = spl_autoload_functions()) { array_map('spl_autoload_unregister', $loaders); } else { $loaders = function_exists('__autoload') ? array('__autoload') : array(); } array_unshift($loaders, array(__CLASS__, 'load')); array_map('spl_autoload_register', $loaders); }
// force classname to lowercase ... make sure we are standardizing it. $class = strtolower($classname); // load the gaia namespaced classes. if (substr($class, 0, 5) == 'gaia\\') { return include $gaia_path . strtr($class, '\\', '/') . '.php'; } // load facebook related classes. if ($class == 'facebook') { return @(include 'phar://' . __DIR__ . '/vendor/facebook.phar/facebook.php'); } if ($class == 'basefacebook') { return @(include 'phar://' . __DIR__ . '/vendor/facebook.phar/base_facebook.php'); } // load yaml vendor classes if ($class == 'sfyaml') { return @(include 'phar://' . __DIR__ . '/vendor/sfyaml.phar/sfYaml.php'); } // load pheanstalk if ($class == 'pheanstalk') { $base = 'phar://' . __DIR__ . '/vendor/pheanstalk.phar'; include $base . '/Pheanstalk/ClassLoader.php'; Pheanstalk_ClassLoader::register($base); include $base . '/Pheanstalk.php'; } // load predis namespaced classes. if (substr($class, 0, 7) == 'predis\\') { return include 'phar://' . __DIR__ . '/vendor/predis.phar/' . strtr($classname, '\\', '/') . '.php'; } // all done. }); });
<?php /** * @link https://github.com/ptrofimov/beanstalk_console * @link http://kr.github.com/beanstalkd/ * @author Petr Trofimov, Sergey Lysenko */ function __autoload($class) { require_once str_replace('_', '/', $class) . '.php'; } session_start(); require_once 'Pheanstalk/ClassLoader.php'; Pheanstalk_ClassLoader::register(dirname(__FILE__)); require_once 'BeanstalkInterface.class.php'; require_once dirname(__FILE__) . '/../config.php'; require_once dirname(__FILE__) . '/../src/Storage.php'; $GLOBALS['server'] = !empty($_GET['server']) ? $_GET['server'] : ''; $GLOBALS['action'] = !empty($_GET['action']) ? $_GET['action'] : ''; $GLOBALS['state'] = !empty($_GET['state']) ? $_GET['state'] : ''; $GLOBALS['count'] = !empty($_GET['count']) ? $_GET['count'] : ''; $GLOBALS['tube'] = !empty($_GET['tube']) ? $_GET['tube'] : ''; $GLOBALS['tplMain'] = !empty($_GET['tplMain']) ? $_GET['tplMain'] : ''; $GLOBALS['tplBlock'] = !empty($_GET['tplBlock']) ? $_GET['tplBlock'] : ''; class Console { public $interface; protected $_tplVars = array(); protected $_globalVar = array(); protected $_errors = array(); private $serversConfig = array();
<?php defined('SYSPATH') or die('No direct script access.'); // Load Zend's Autoloader if ($path = Kohana::find_file('vendor', 'pheanstalk/classes/Pheanstalk')) { ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . dirname($path)); require_once "Pheanstalk/ClassLoader.php"; Pheanstalk_ClassLoader::register(dirname($path)); }
<?php /** * Pheanstalk init script. * Sets up include paths based on the directory this file is in. * Registers an SPL class autoload function. * * @author Paul Annesley * @package Pheanstalk * @licence http://www.opensource.org/licenses/mit-license.php */ $pheanstalkClassRoot = dirname(__FILE__) . '/classes'; require_once $pheanstalkClassRoot . '/Pheanstalk/ClassLoader.php'; Pheanstalk_ClassLoader::register($pheanstalkClassRoot);
#!/usr/bin/env php <?php /** * Basic command line test runner for Pheanstalk. * * @author Paul Annesley * @package Pheanstalk * @licence http://www.opensource.org/licenses/mit-license.php */ error_reporting(E_ALL); ini_set('display_errors', true); $basedir = realpath(dirname(__FILE__) . '/..'); require "{$basedir}/pheanstalk_init.php"; Pheanstalk_ClassLoader::addPath(array("{$basedir}/tests/simpletest", "{$basedir}/tests")); if (in_array('--help', $argv)) { echo <<<EOM CLI test runner. Available options: --with-server Includes tests which connect to a beanstalkd server --testfile <path> Only run the specified test file. --help This documentation. EOM; exit(0); } require_once 'simpletest/unit_tester.php'; require_once 'simpletest/reporter.php';
/** * Carga bibliotecas de pheanstalk */ function _inicializa_pheanstalk() { $pheanstalkClassRoot = getcwd() . '/' . APPPATH . 'libraries/pheanstalk/classes'; require_once $pheanstalkClassRoot . '/Pheanstalk/ClassLoader.php'; Pheanstalk_ClassLoader::register($pheanstalkClassRoot); }