Ejemplo n.º 1
0
 public function testEndToEndCli()
 {
     global $argv, $argc;
     $_SERVER['argv'] = array('someKey=someValue', 'otherKey=otherValue');
     $_SERVER['argc'] = 3;
     $expectedResult = array('someKey' => 'someValue', 'otherKey' => 'otherValue');
     $obj = new Tiki_Request();
     foreach ($expectedResult as $key => $value) {
         $this->assertEquals($value, $obj->getProperty($key));
     }
 }
Ejemplo n.º 2
0
 *
 *
 * If you want to know the translation progression for your language, just visit : http://i18n.tiki.org/status
 * which is made with http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki/trunk/doc/devtools/get_translation_percentage.php?view=markup
 *
 */
if (php_sapi_name() != 'cli') {
    require_once 'tiki-setup.php';
    $access->check_permission('tiki_p_admin');
}
require_once 'lib/init/initlib.php';
require_once 'lib/setup/timer.class.php';
$timer = new timer();
$timer->start();
$options = array();
$request = new Tiki_Request();
if ($request->hasProperty('lang')) {
    $options['lang'] = $request->getProperty('lang');
}
if ($request->hasProperty('outputFiles')) {
    $options['outputFiles'] = $request->getProperty('outputFiles');
}
$excludeDirs = array('dump', 'img', 'lang', 'vendor', 'vendor_extra', 'lib/test', 'temp', 'temp/cache', 'templates_c');
$includeFiles = array('./lang/langmapping.php', './img/flags/flagnames.php');
// command-line only options
if (php_sapi_name() == 'cli') {
    if ($request->hasProperty('baseDir')) {
        $options['baseDir'] = $request->getProperty('baseDir');
        // when a custom base dir is set, default $includeFiles and $excludeDirs are not used
        $includeFiles = array();
        $excludeDirs = array();
    $access->check_permission('tiki_p_send_newsletters');
}
global $nllib;
include_once 'lib/newsletters/nllib.php';
function display_usage()
{
    $helpMsg = "\nUsage: php tiki-batch_send_newsletter.php editionId=X\n" . "Usage: http://path_to_tiki/tiki-batch_send_newsletter.php?editionId=X\n";
    if (php_sapi_name() == 'cli') {
        echo $helpMsg;
    } else {
        echo nl2br($helpMsg);
    }
    die;
}
error_reporting(E_ALL);
$request = new Tiki_Request();
$editionId = $request->getProperty('editionId');
if (empty($editionId)) {
    display_usage();
}
if (!($edition_info = $nllib->get_edition($editionId))) {
    echo "Incorrect editionId: {$editionId}";
    die;
}
if (!($nl_info = $nllib->get_newsletter($edition_info['nlId']))) {
    echo 'Incorrect nlId: ' . $edition_info['nlId'];
}
$edition_info['editionId'] = 0;
$sent = $errors = array();
$logFileName = '';
$edition_info['begin'] = 'y';