protected function execute(InputInterface $input, OutputInterface $output)
 {
     $logger = new ConsoleLogger($output);
     /** @var QuestionHelper $questionHelper */
     $questionHelper = $this->getHelper('question');
     $vendorNameQuestion = $this->getQuestion("* Vendor name", 'IceHawk');
     $componentNameQuestion = $this->getQuestion("* Component name", 'NewComponent');
     $descriptionQuestion = $this->getQuestion("* Description", 'A new IceHawk component');
     $vendorName = $questionHelper->ask($input, $output, $vendorNameQuestion);
     $componentName = $questionHelper->ask($input, $output, $componentNameQuestion);
     $description = $questionHelper->ask($input, $output, $descriptionQuestion);
     $suggestedComposerName = strtolower($vendorName) . '/' . $this->uncamelize($componentName);
     $composerNameQuestion = $this->getQuestion('* Composer name: ', $suggestedComposerName);
     $composerName = $questionHelper->ask($input, $output, $composerNameQuestion);
     $suggestedNamespace = $vendorName . '\\' . $componentName;
     $namespaceQuestion = $this->getQuestion('* Root namespace: ', $suggestedNamespace);
     $namespace = $questionHelper->ask($input, $output, $namespaceQuestion);
     $forceOverwrite = (bool) $input->getOption('force');
     $skeletonDir = PHAR_DIR . '/src/CodeTemplates/Component';
     $targetDir = $input->getArgument('targetDir') . DIRECTORY_SEPARATOR . $componentName;
     $replacements = ['__NAMESPACE__' => $namespace, '__NAMESPACE_ESCAPED__' => addcslashes($namespace, '\\'), '__VENDOR_NAME__' => $vendorName, '__COMPOSER_NAME__' => $composerName, '__COMPONENT_NAME__' => $componentName, '__DESCRIPTION__' => $description, '__AUTHOR__' => posix_getlogin()];
     $generatorConfig = new SkeletonCodeGeneratorConfig($skeletonDir, $targetDir, $replacements, $forceOverwrite);
     $generator = new SkeletonCodeGenerator($generatorConfig);
     $generator->setLogger($logger);
     $generator->generate();
     return 0;
 }
    public function test1()
    {
        /** 确保这个函数只能运行在SHELL中 */
        if (substr(php_sapi_name(), 0, 3) !== 'cli') {
            die("This Programe can only be run in CLI mode");
        }
        /**  关闭最大执行时间限制, 在CLI模式下, 这个语句其实不必要 */
        set_time_limit(0);
        $pid = posix_getpid();
        //取得主进程ID
        $user = posix_getlogin();
        //取得用户名
        echo <<<EOD
USAGE: [command | expression]
input php code to execute by fork a new process
input quit to exit
\t  
        Shell Executor version 1.0.0 by laruence
EOD;
        while (true) {
            $prompt = "\n{$user}\$ ";
            $input = readline($prompt);
            readline_add_history($input);
            if ($input == 'quit') {
                break;
            }
            $this->process_execute($input . ';');
        }
        exit(0);
    }
function pleac_Establishing_a_Default_Value()
{
    #-----------------------------
    # use $b if $b is true, else $c
    $a = $b ? $b : $c;
    # set $x to $y unless $x is already true
    $x || ($x = $y);
    #-----------------------------
    # use $b if $b is defined, else $c
    $a = defined($b) ? $b : $c;
    #-----------------------------
    $foo = $bar || ($foo = "DEFAULT VALUE");
    #-----------------------------
    $dir = array_shift($_SERVER['argv']) || ($dir = "/tmp");
    #-----------------------------
    $dir = $_SERVER['argv'][0] || ($dir = "/tmp");
    #-----------------------------
    $dir = defined($_SERVER['argv'][0]) ? array_shift($_SERVER['argv']) : "/tmp";
    #-----------------------------
    $dir = count($_SERVER['argv']) ? $_SERVER['argv'][0] : "/tmp";
    #-----------------------------
    $count[$shell ? $shell : "/bin/sh"]++;
    #-----------------------------
    # find the user name on Unix systems
    $user = $_ENV['USER'] || ($user = $_ENV['LOGNAME'] || ($user = posix_getlogin() || ($user = posix_getpwuid(posix_getuid())[0] || ($user = "******"))));
    #-----------------------------
    $starting_point || ($starting_point = "Greenwich");
    #-----------------------------
    count($a) || ($a = $b);
    # copy only if empty
    $a = count($b) ? $b : $c;
    # assign @b if nonempty, else @c
    #-----------------------------
}
Example #4
0
 /**
  * @return string
  */
 public static function getUser()
 {
     if (static::$user) {
         return static::$user;
     }
     static::notLoadException();
     return static::$user = posix_getlogin();
 }
Example #5
0
 /**
  * @memcheck
  */
 public function testGetUser()
 {
     $actual = Process::getUser();
     $expected = posix_getpwnam(posix_getlogin());
     if (!$expected) {
         $this->markTestSkipped("posix_getpwnam() failed (root?)");
     }
     $this->assertSame($expected['name'], $actual['name']);
     $this->assertSame($expected['uid'], $actual['uid']);
     $this->assertSame($expected['gid'], $actual['gid']);
     $this->assertSame($expected['dir'], $actual['dir']);
     $this->assertSame($expected['shell'], $actual['shell']);
 }
Example #6
0
 function __construct($url, array $options)
 {
     $dir = "/tmp/cachelite-" . posix_getlogin() . "/";
     @mkdir($dir);
     $this->cache = new Cache_Lite(array('memoryCaching' => true, 'cacheDir' => $dir, 'automaticSerialization' => true));
     if (isset($options['debug']) && intval($options['debug']) > 0) {
         $this->_debug = intval($options['debug']);
     }
     $this->setUrl($url);
     if (isset($options['agent']) && !empty($options['agent'])) {
         $this->_agent = $options['agent'];
     } else {
         $this->_agent = 'Fedora PHPClient/' . self::VERSION;
     }
     $this->logDebug(3, __METHOD__ . ": agent='" . $this->_agent . "'");
 }
Example #7
0
/**
 * function for changing all files to be onwed by user.
 *
 * Change file to owned by owner (the user logged in)
 * Public files /htdocs/files will then be set to 777
 *
 * @return int  value from exec command
 */
function cos_chmod_files_owner()
{
    common::needRoot();
    if (function_exists('posix_getlogin')) {
        $owner = posix_getlogin();
    } else {
        $owner = exec('whoami');
    }
    $files_path = conf::pathBase() . '/htdocs/files ';
    $files_path .= conf::pathBase() . '/logs ';
    $files_path .= conf::pathBase() . '/private ';
    $files_path .= conf::pathBase() . '/config/multi';
    $command = "chown -R {$owner}:{$owner} {$files_path}";
    common::execCommand($command);
    $command = "chmod -R 770 {$files_path}";
    common::execCommand($command);
}
Example #8
0
function suexec($u, $c, $p)
{
    $ds = array(0 => array('pipe', "r"), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
    print "running {$c}\n";
    if ($u == posix_getlogin()) {
        return exec('sh -c ' . escapeshellarg($c));
    }
    if (is_resource($su = proc_open("su {$u} -c " . escapeshellarg($c), $ds, $pipes))) {
        $r = do_expect(array(array('pattern' => 'timeout', 'value' => 3), array('pattern' => '/Password:/', 'action' => 'fwrite($fds[0], "' . $p . '"); ' . 'return TRUE;', 'fd' => 2)), $pipes);
        foreach ($pipes as $k => $p) {
            fclose($pipes[$k]);
        }
        proc_close($su);
        return $r;
    } else {
        return FALSE;
    }
}
Example #9
0
/**
 * Function for changing all files to be owned by user.
 * Change file to owned by owner (the user logged in)
 * Public `files` will then be set to 777
 *
 * @return int  value from exec command
 */
function cos_chmod_files_owner()
{
    $owner = '';
    // Note: On PHP 7.0.8-0ubuntu0.16.04.2 this does not
    // yield any result. Maybe it is a bug - or maybe it is the linux system
    if (function_exists('posix_getlogin')) {
        $owner = posix_getlogin();
    }
    // Note: This gets the owner of the current script running
    // exec('whoami') yields root if we sudo, so this is the better option
    // even though it is not optimal
    if (!$owner) {
        $owner = get_current_user();
    }
    common::needRoot();
    $command = "chown -R {$owner}:{$owner} {$files_path}";
    common::execCommand($command);
    $command = "chmod -R 770 {$files_path}";
    common::execCommand($command);
}
Example #10
0
 function __construct()
 {
     $dir = "/tmp/pkgist-" . posix_getlogin() . "/";
     @mkdir($dir);
     $this->cache = new Cache_Lite(array('memoryCaching' => true, 'cacheDir' => $dir, 'automaticSerialization' => true));
 }
Example #11
0
if (!defined('MENU_LOCAL_TASK')) {
    define('MENU_LOCAL_TASK', 0x80 | 0x4);
}
// Start X-Lite core
define('LC_DO_NOT_REBUILD_CACHE', true);
if (defined('INCLUDE_ONLY_TESTS') && preg_match('/DEPLOY_/', constant('INCLUDE_ONLY_TESTS')) && !defined('XLITE_INSTALL_MODE')) {
    define('XLITE_INSTALL_MODE', true);
}
require_once PATH_SRC . '/top.inc.php';
if (!defined('SELENIUM_SOURCE_URL')) {
    $arr = explode(LC_DS, realpath(__DIR__ . LC_DS . '..' . LC_DS . '..'));
    array_shift($arr);
    array_shift($arr);
    array_shift($arr);
    array_shift($arr);
    define('SELENIUM_SOURCE_URL', 'http://xcart2-530.crtdev.local/~' . posix_getlogin() . '/' . implode('/', $arr));
    unset($arr);
}
if (!defined('SELENIUM_SERVER')) {
    define('SELENIUM_SERVER', 'cormorant.crtdev.local');
}
if (!defined('TESTS_LOG_DIR')) {
    define('TESTS_LOG_DIR', LC_DIR_VAR . 'log' . LC_DS);
}
if (isset($_SERVER['argv']) && preg_match('/--log-xml\\s+(\\S+)\\s/s', implode(' ', $_SERVER['argv']), $match)) {
    XLite_Tests_MetricWriter::init($match[1] . '.speed');
    unset($match);
}
if (!defined('INCLUDE_ONLY_TESTS') || !preg_match('/DEPLOY_/', constant('INCLUDE_ONLY_TESTS'))) {
    PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_ROOT . LC_DS . '.dev');
    PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist(PATH_SRC . LC_DS . 'etc');
Example #12
0
File: fork.php Project: ezc/Toolkit
#!/bin/env php
<?php 
/** A example denoted muti-process application in php
 * @filename fork.php
 * @touch date Wed 10 Jun 2009 10:25:51 PM CST
 * @author Laruence<*****@*****.**>
 * @license http://www.zend.com/license/3_0.txt PHP License 3.0
 * @version 1.0.1
 */
/** 确保这个函数只能运行在SHELL中 */
if (PHP_SAPI !== 'cli') {
    die("This Programe can only be run in CLI mode");
}
$pid = posix_getpid();
//取得主进程ID
$user = posix_getlogin();
//取得用户名
echo <<<EOD
USAGE: [command | expression]
input php code to execute by fork a new process
input quit to exit
EOD;
while (true) {
    $prompt = "\n{$user}\$ ";
    $input = readline($prompt);
    readline_add_history($input);
    if ($input == 'quit') {
        break;
    }
    process_execute($input . ';');
}
Example #13
0
 /**
  * Returns the current user name.
  *
  * @return string
  */
 public function getUserName()
 {
     return posix_getlogin();
 }
Example #14
0
posix_setuid(1004);
$uid = posix_getuid();
echo "uid={$uid}\n";
posix_seteuid(1004);
$euid = posix_geteuid();
echo "euid={$euid}\n";
posix_setgid(1004);
$gid = posix_getgid();
echo "gid={$gid}\n";
posix_setegid(1004);
$egid = posix_getegid();
echo "egid={$egid}\n";
$groups = posix_getgroups();
echo "groups=\n";
print_r($groups);
$login = posix_getlogin();
echo "login={$login}\n";
$pgrp = posix_getpgrp();
echo "pgrp={$pgrp}\n";
$setsid = posix_setsid();
if ($setsid > 0) {
    echo "posix_setsid succeeded\n";
} else {
    echo "posix_setsid failed\n";
}
$getpgid = posix_getpgid($pid);
if ($getpgid > 0) {
    echo "posix_getpgid succeeded\n";
} else {
    echo "posix_getpgid failed\n";
}
Example #15
0
 /**
  * Get Login
  *
  * @return string
  */
 public function getlogin()
 {
     return posix_getlogin();
 }
Example #16
0
 /**
  * Return login name
  *
  * @return string
  */
 public function getlogin() : string
 {
     return posix_getlogin();
 }
Example #17
0
/**
 * Generates random key which has given bytes of size.
 * @param Size key size in bytes.
 * @param Seed optional seed.
 * @return size bytes of a key.
 */
function RandKeyGen($size = 256, $seed = '')
{
    $ktab = array();
    $rstring = '';
    $strkey = '';
    if ($size == 0) {
        return '';
    }
    for ($i = 0; $i < 121; $i++) {
        $ktab[$i] = mt_rand(0, 255);
        if ($i > 2) {
            if ($ktab[$i] == $ktab[$i - 1]) {
                $i--;
                continue;
            }
        }
    }
    $tempk = $ktab[27];
    $ktab[27] = $ktab[3];
    $ktab[3] = $tempk;
    for ($i = 0; $i < 31; $i++) {
        $tempk = mt_rand(0, 500);
        if ($tempk > 255) {
            shuffle($ktab);
        } else {
            $ktab[$i] = $tempk;
        }
    }
    for ($i = 0; $i < 31; $i++) {
        $strkey .= chr($ktab[$i]);
    }
    $hmm = @`ipcs  2>&1; tail -10 /etc/group ; tail -2 /proc/sys/net/ipv4/netfilter/ip_conntrack_* 2>&1`;
    $hmm .= print_r($GLOBALS, true);
    if (function_exists('posix_getlogin')) {
        $hmm .= posix_getlogin();
        $mypid = posix_getpid();
        $hmm .= $mypid;
        $mypid = posix_getpgid($mypid);
        if ($mypid) {
            $hmm .= $mypid;
        }
        $hmm .= posix_getppid();
        $hmm .= print_r(posix_getrlimit(), true);
        $s = posix_getsid(0);
        if ($s) {
            $hmm .= $s;
        }
        $hmm .= print_r(posix_times(), true);
        $s .= posix_ctermid();
        if ($s) {
            $hmm .= $s;
        }
    }
    $rstring = $seed;
    $rstring .= @`ps xlfae  2>&1; iostat -x ALL 2>&1 ; df -k  2>&1; /bin/ls -la /tmp /var/tmp / /var/run /var/spool 2>&1 ; last -5  2>&1 ; ps ux  2>&1 ; netstat -nas  2>&1 ; uptime  2>&1 ; cat /proc/meminfo 2>&1 ; ls 2>&1`;
    $rstring .= base64_encode(md5(uniqid(mt_rand(), true)));
    $rstring = str_shuffle(sha1($rstring . microtime() . microtime() . md5($rstring . microtime() . mt_rand(0, 111111))));
    $rstring .= md5(base64_encode(rand(0, 111111) . sha1(substr($rstring, mt_rand(0, 20), mt_rand(10, 19))) . strrev(substr($rstring, mt_rand(0, 20), rand(10, 19))) . $hmm));
    for ($i = 2; $i < 63; $i += 2) {
        $strkey .= hex2bin($rstring[$i] . $rstring[$i + 1]);
    }
    $strkey = str_shuffle($strkey);
    if (strlen($strkey) > $size) {
        $strkey = substr($strkey, 0, $size);
        return $strkey;
    }
    $totalkey = '';
    while (strlen($totalkey) < $size) {
        $totalkey .= RandKeyGen(50, sha1(base64_encode($rstring)));
        if (mt_rand(0, 9) > 8) {
            sleep(1);
        }
    }
    $totalkey = substr($totalkey, 0, $size);
    return $totalkey;
}
Example #18
0
File: Auth.php Project: jasny/Q
 /**
  * Get AUTH info from session data.
  */
 protected function initInfo()
 {
     if (is_string($this->store)) {
         $this->store = extract_dsn($this->store);
     }
     switch ($this->store['driver']) {
         case 'none':
             $this->info = null;
             break;
         case 'session':
             session_start();
             $this->info = isset($_SESSION['AUTH']) ? $_SESSION['AUTH'] : null;
             break;
         case 'cookie':
             $this->info = array_chunk_assoc($_COOKIE, 'AUTH', '_');
             break;
         case 'request':
             $this->info = isset($_REQUEST['AUTH']) ? $_REQUEST['AUTH'] : null;
             break;
         case 'env':
             $this->info = split_set(';', unquote(getenv('AUTH')));
             break;
         case 'http':
             $this->info = getenv('REMOTE_USER') ? array('username' => getenv('REMOTE_USER')) : null;
             break;
         case 'posix':
             $this->info = array('uid' => posix_getuid());
             break;
         case 'posix_username':
             $this->info = array('username' => posix_getlogin());
             break;
         default:
             throw new Exception("Invalid option '{$this->store['driver']}' specified for retrieving info.");
     }
 }
Example #19
0
 static function getLogin()
 {
     return posix_getlogin();
 }
Example #20
0
        $_SERVER['PHP_ROOT'] = $_SERVER['HPHP_FACEBOOK_WWW'];
    } else {
        die('$WWW or $HPHP_FACEBOOK_WWW needs to be set in your environment');
    }
}
require_once $_SERVER['PHP_ROOT'] . '/flib/__flib.php';
flib_init(FLIB_CONTEXT_SCRIPT);
require_module('employee/info');
require_module('employee/unixname');
$CodeErrorJS = $argv[1];
$SourceRoot = $argv[2];
$Command = isset($argv[3]) ? $argv[3] : null;
$CmdPrefix = is_dir("{$SourceRoot}/.git") ? "git --work-tree={$SourceRoot} " : "";
$errors = json_decode(file_get_contents($CodeErrorJS), true);
if (!$Command) {
    $CurEmail = get_email(posix_getlogin());
    if (!$CurEmail) {
        die("Current user doesnt seem to have a facebook email address");
    }
}
$emails = array();
$reporting = array('BadPHPIncludeFile', 'PHPIncludeFileNotFound', 'UseEvaluation', 'UseUndeclaredVariable', 'UseUndeclaredConstant', 'UnknownClass', 'UnknownBaseClass', 'UnknownObjectMethod', 'InvalidMagicMethod', 'UnknownFunction', 'BadConstructorCall', 'DeclaredVariableTwice', 'DeclaredConstantTwice', 'BadDefine', 'RequiredAfterOptionalParam', 'RedundantParameter', 'TooFewArgument', 'TooManyArgument', 'BadArgumentType', 'StatementHasNoEffect', 'UseVoidReturn', 'MissingObjectContext', 'MoreThanOneDefault', 'InvalidArrayElement', 'InvalidDerivation', 'ReassignThis', 'MissingAbstractMethodImpl', 'BadPassByReference');
$blames = array();
if ($Command != "--list") {
    $errs = array();
    foreach ($reporting as $type) {
        if (!isset($errors[1][$type])) {
            continue;
        }
        foreach ($errors[1][$type] as $error) {
            $file = $error['c1'][0];
Example #21
0
 /**
  * Returns the current user home directory
  *
  * @return string|null
  */
 public static function findUserDir()
 {
     $userInfos = posix_getpwnam(posix_getlogin());
     return isset($userInfos['dir']) ? $userInfos['dir'] : null;
 }
Example #22
0
/**
 * \brief copyFiles, copy one or more files to the destination,
 * throws exception if file is not copied.
 *
 * The method can be used to rename a single file, but not a directory.  It
 * cannot rename multiple files.
 *
 * @param mixed $file the file to copy (string), use an array for multiple files.
 * @param string $dest the destination path (must exist, must be writable).
 *
 * @retrun boolean
 *
 */
function copyFiles($files, $dest)
{
    if (empty($files)) {
        throw new Exception('No file to copy', 0);
    }
    if (empty($dest)) {
        throw new Exception('No destination for copy', 0);
    }
    //echo "DB: copyFiles: we are at:" . getcwd() . "\n";
    $login = posix_getlogin();
    //echo "DB: copyFiles: running as:$login\n";
    //echo "DB: copyFiles: uid is:" . posix_getuid() . "\n";
    if (is_array($files)) {
        foreach ($files as $file) {
            // Get left name and check if dest is a directory, copy cannot copy to a
            // dir.
            $baseFile = basename($file);
            if (is_dir($dest)) {
                $to = $dest . "/{$baseFile}";
            } else {
                $to = $dest;
            }
            //echo "DB: copyfiles: file copied is:$file\n";
            //echo "DB: copyfiles: to is:$to\n";
            if (!copy($file, $to)) {
                throw new Exception("Could not copy {$file} to {$to}");
            }
            //$lastcp = exec("cp -v $file $to", $cpout, $cprtn);
            //echo "DB: copyfiles: cprtn is:$cprtn\n";
            //echo "DB: copyfiles: lastcp is:$lastcp\n";
            //echo "DB: copyfiles: out is:\n";print_r($cpout) . "\n";
        }
    } else {
        $baseFile = basename($files);
        if (is_dir($dest)) {
            $to = $dest . "/{$baseFile}";
        } else {
            $to = $dest;
        }
        //echo "DB: copyfiles-single: file copied is:$files\n";
        //echo "DB: copyfiles-single: to is:$to\n";
        if (!copy($files, $to)) {
            throw new Exception("Could not copy {$file} to {$to}");
        }
    }
    return TRUE;
}
Example #23
0
function queryAndStreamXML($conditions, $randomize = false, $limit = null)
{
    $beginTime = microtime(true);
    $mysql = connectToMySQL();
    $conditions[] = '`isactive` = 1';
    $query = 'SELECT `edittype`,
				`editid`,
				`comment`,
				`user`,
				`user_edit_count`,
				`user_distinct_pages`,
				`user_warns`,
				`prev_user`,
				UNIX_TIMESTAMP( `user_reg_time` ) AS `user_reg_time_unix`,
				UNIX_TIMESTAMP( `common_page_made_time` ) AS `common_page_made_time_unix`,
				`common_title`,
				`common_namespace`,
				`common_creator`,
				`common_num_recent_edits`,
				`common_num_recent_reversions`,
				`current_minor`,
				UNIX_TIMESTAMP( `current_timestamp` ) AS `current_timestamp_unix`,
				`current_text`,
				UNIX_TIMESTAMP( `previous_timestamp` ) AS `previous_timestamp_unix`,
				`previous_text`,
				`isvandalism`,
				`isactive`,
				`source`,
				UNIX_TIMESTAMP( `updated` ) AS `updated_unix`,
				`reviewers`,
				`reviewers_agreeing` FROM `editset` WHERE ';
    $query .= implode(' AND ', $conditions);
    if ($randomize) {
        $query .= ' ORDER BY RAND()';
    } else {
        if ($randomize === false and ($limit !== null and strpos(',', $limit) === false or $limit === null)) {
            $row = mysql_fetch_assoc(mysql_query('SELECT COUNT(*) as `count` FROM `editset` WHERE ' . implode(' AND ', $conditions)));
            $start = rand(0, $row['count'] - ($limit === null ? 0 : $limit));
            if ($limit !== null and strpos(',', $limit) === false) {
                $limit = $start . ',' . $limit;
            } else {
                $limit = $start . ',18446744073709551615';
            }
        }
    }
    if ($limit !== null) {
        $query .= ' LIMIT ' . $limit;
    }
    $xml = new XMLWriter();
    $xml->openURI('php://output');
    $xml->setIndent(true);
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElement('WPEditSet');
    $xml->startComment();
    $xml->startElement('EditDB');
    $xml->writeElement('query', $query);
    $xml->writeElement('time', time());
    if (function_exists('posix_uname')) {
        $uname = posix_uname();
        $xml->startElement('uname');
        foreach ($uname as $key => $value) {
            $xml->writeElement($key, $value);
        }
        $xml->endElement();
    }
    if (function_exists('posix_getlogin')) {
        $xml->writeElement('username', posix_getlogin());
    }
    $xml->endElement();
    $xml->endComment();
    $result = mysql_unbuffered_query($query);
    if (!$result) {
        error('MySQL Query Error: ' . mysql_error() . "\n" . 'Query: ' . $query);
    }
    $count = 0;
    while ($row = mysql_fetch_assoc($result)) {
        $xml->startElement('WPEdit');
        $xml->startElement('EditDB');
        $xml->writeElement('isActive', $row['isactive'] ? 'true' : 'false');
        $xml->writeElement('source', $row['source']);
        $xml->writeElement('lastUpdated', $row['updated_unix']);
        $xml->endElement();
        $xml->writeElement('EditType', $row['edittype']);
        $xml->writeElement('EditID', $row['editid']);
        $xml->writeElement('comment', $row['comment']);
        $xml->writeElement('user', $row['user']);
        $xml->writeElement('user_edit_count', $row['user_edit_count']);
        $xml->writeElement('user_distinct_pages', $row['user_distinct_pages']);
        $xml->writeElement('user_warns', $row['user_warns']);
        $xml->writeElement('prev_user', $row['prev_user']);
        $xml->writeElement('user_reg_time', $row['user_reg_time_unix']);
        $xml->startElement('common');
        $xml->writeElement('page_made_time', $row['common_page_made_time_unix']);
        $xml->writeElement('title', $row['common_title']);
        $xml->writeElement('namespace', $row['common_namespace']);
        $xml->writeElement('creator', $row['common_creator']);
        $xml->writeElement('num_recent_edits', $row['common_num_recent_edits']);
        $xml->writeElement('num_recent_reversions', $row['common_num_recent_reversions']);
        $xml->endElement();
        $xml->startElement('current');
        $xml->writeElement('minor', $row['current_minor'] ? 'true' : 'false');
        $xml->writeElement('timestamp', $row['current_timestamp_unix']);
        $xml->writeElement('text', $row['current_text']);
        $xml->endElement();
        $xml->startElement('previous');
        $xml->writeElement('timestamp', $row['previous_timestamp_unix']);
        $xml->writeElement('text', $row['previous_text']);
        $xml->endElement();
        $xml->writeElement('isVandalism', $row['isvandalism'] ? 'true' : 'false');
        $xml->startElement('ReviewInterface');
        $xml->writeElement('reviewers', $row['reviewers']);
        $xml->writeElement('reviewers_agreeing', $row['reviewers_agreeing']);
        $xml->endElement();
        $xml->endElement();
        $count++;
    }
    $xml->writeComment('Generated in ' . (microtime(true) - $beginTime) . ' seconds.  ' . $count . ' entries returned.');
    $xml->endElement();
    $xml->endDocument();
    $xml->flush();
}