N98\Util\OperatingSystem::isRoot PHP Method

isRoot() public static method

Returns false negatives if posix_getuid() is not available.
public static isRoot ( ) : boolean
return boolean
    public static function isRoot()
    {
        return function_exists('posix_getuid') && posix_getuid() === self::UID_ROOT;
    }

Usage Example

コード例 #1
0
ファイル: CheckRootUser.php プロジェクト: netz98/n98-magerun
 /**
  * Display a warning if a running n98-magerun as root user
  *
  * @param Event $event
  * @return void
  */
 public function checkRunningAsRootUser(Event $event)
 {
     if ($this->_isSkipRootCheck($event->getInput())) {
         return;
     }
     $config = $event->getApplication()->getConfig();
     if (!$config['application']['check-root-user']) {
         return;
     }
     if (OperatingSystem::isRoot()) {
         $output = $event->getOutput();
         $output->writeln(array('', self::WARNING_ROOT_USER, ''));
     }
 }