getUserAndGroup() public static method

public static getUserAndGroup ( )
コード例 #1
0
ファイル: PiwikJsCheck.php プロジェクト: diosmosis/piwik
 public function execute()
 {
     $label = $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsWritable');
     $file = new File(PIWIK_DOCUMENT_ROOT . '/piwik.js');
     if ($file->hasWriteAccess()) {
         return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, ''));
     }
     $comment = $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsNotWritable');
     if (!SettingsServer::isWindows()) {
         $realpath = Filesystem::realpath(PIWIK_INCLUDE_PATH . '/piwik.js');
         $command = "<br/><code> chmod +w {$realpath}<br/> chown " . Filechecks::getUserAndGroup() . " " . $realpath . "</code><br />";
         $comment .= $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsMakeWritable', $command);
     }
     return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
 }
コード例 #2
0
ファイル: Update.php プロジェクト: piwik/piwik
 /**
  * @param OutputInterface $output
  */
 protected function writeAlertMessageWhenCommandExecutedWithUnexpectedUser(OutputInterface $output)
 {
     if (SettingsServer::isWindows()) {
         // does not work on windows
         return;
     }
     $processUserAndGroup = Filechecks::getUserAndGroup();
     $fileOwnerUserAndGroup = Filechecks::getOwnerOfPiwikFiles();
     if (!$fileOwnerUserAndGroup || $processUserAndGroup == $fileOwnerUserAndGroup) {
         // current process user/group appear to be same as the Piwik filesystem user/group -> OK
         return;
     }
     $output->writeln(sprintf("<comment>It appears you have executed this update with user %s, while your Piwik files are owned by %s. \n\nTo ensure that the Piwik files are readable by the correct user, you may need to run the following command (or a similar command depending on your server configuration):\n\n\$ %s</comment>", $processUserAndGroup, $fileOwnerUserAndGroup, Filechecks::getCommandToChangeOwnerOfPiwikFiles()));
 }