protected function checkService() { $passed = true; $applicationLogWritable = InstallUtil::isApplicationLogRuntimeWritable(INSTANCE_ROOT); if ($applicationLogWritable) { $this->message = Zurmo::t('InstallModule', 'The application.log runtime file is writable.'); } else { $this->message = Zurmo::t('InstallModule', 'The application.log runtime file is not writable.'); $passed = false; } if (!extension_loaded('apc')) { $minScriptCacheDirectoryWritable = InstallUtil::isMinScriptCacheRuntimeDirectoryWritable(INSTANCE_ROOT); if ($minScriptCacheDirectoryWritable) { $this->message .= "\n" . Zurmo::t('InstallModule', 'The /minScript/cache runtime directory is writable.'); } else { $this->message .= "\n" . Zurmo::t('InstallModule', 'The /minScript/cache runtime directory is not writable.'); $passed = false; } } $debugExists = InstallUtil::doesDebugConfigExist(INSTANCE_ROOT); if ($debugExists) { $this->message .= "\n" . Zurmo::t('InstallModule', 'The debug.php file is present.'); } else { $this->message .= "\n" . Zurmo::t('InstallModule', 'The debug.php file is not present.'); $passed = false; } return $passed; }
/** * Execute the action. * @param array command line parameters specific for this command */ public function run($args) { set_time_limit('900'); if (!isset($args[0])) { $this->usageError('A username must be specified.'); } try { Yii::app()->user->userModel = User::getByUsername($args[0]); } catch (NotFoundException $e) { $this->usageError('The specified username does not exist.'); } $group = Group::getByName(Group::SUPER_ADMINISTRATORS_GROUP_NAME); if (!$group->users->contains(Yii::app()->user->userModel)) { $this->usageError('The specified user is not a super administrator.'); } $startTime = microtime(true); $template = "{message}\n"; $messageStreamer = new MessageStreamer($template); $messageStreamer->setExtraRenderBytes(0); $messageStreamer->add(Zurmo::t('Commands', 'Starting schema update process.')); $messageLogger = new MessageLogger($messageStreamer); InstallUtil::runAutoBuildFromUpdateSchemaCommand($messageLogger); $messageStreamer->add(Zurmo::t('Commands', 'Autobuild complete, rebuilding read permissions.')); if (SHOW_QUERY_DATA) { $messageStreamer->add(PageView::getTotalAndDuplicateQueryCountContent()); } ReadPermissionsOptimizationUtil::rebuild(); $messageStreamer->add(Zurmo::t('Commands', 'Rebuild read permissions complete.')); $endTime = microtime(true); $messageStreamer->add(Zurmo::t('Commands', 'Schema update complete.')); $messageStreamer->add(Zurmo::t('Commands', 'Total run time: {formattedTime} seconds.', array('{formattedTime}' => number_format($endTime - $startTime, 3)))); if (SHOW_QUERY_DATA) { $messageStreamer->add(PageView::getTotalAndDuplicateQueryCountContent()); } }
public function testSaveAllMetadata() { $super = User::getByUsername('super'); Yii::app()->user->userModel = $super; $this->assertTrue(ContactsModule::loadStartingData()); $messageLogger = new MessageLogger(); InstallUtil::autoBuildDatabase($messageLogger, true); chdir(COMMON_ROOT . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'commands'); $command = "php zurmocTest.php manageMetadata super saveAllMetadata"; if (!IS_WINNT) { $command .= ' 2>&1'; } exec($command, $output); // Check if data are saved for some specific View $moduleMetadata = ZurmoRedBean::getRow("SELECT * FROM globalmetadata WHERE classname='NotesModule'"); $this->assertTrue($moduleMetadata['id'] > 0); $this->assertTrue(strlen($moduleMetadata['serializedmetadata']) > 0); // Check if data are saved for some specific View $modelMetadata = ZurmoRedBean::getRow("SELECT * FROM globalmetadata WHERE classname='Note'"); $this->assertTrue($modelMetadata['id'] > 0); $this->assertTrue(strlen($modelMetadata['serializedmetadata']) > 0); // Check if data are saved for some specific View $viewMetadata = ZurmoRedBean::getRow("SELECT * FROM globalmetadata WHERE classname='ContactsListView'"); $this->assertTrue($viewMetadata['id'] > 0); $this->assertTrue(strlen($viewMetadata['serializedmetadata']) > 0); }
protected function renderControlEditable() { assert('$this->model instanceof ImportWizardForm'); assert('$this->attribute == null'); $existingFilesInformation = array(); if (!empty($this->model->fileUploadData)) { $existingFilesInformation[] = $this->model->fileUploadData; $existingFilesInformation[0]['id'] = $this->model->id; } $content = $this->renderDelimiterAndEnclosureContent($existingFilesInformation); $inputNameAndId = $this->getEditableInputId('file'); $beforeUploadAction = "\$('#{$this->getEditableInputId('rowColumnDelimiter')}').attr('readonly', true);"; $beforeUploadAction .= "\$('#{$this->getEditableInputId('rowColumnDelimiter')}').addClass('readonly-field');"; $beforeUploadAction .= "\$('#{$this->getEditableInputId('rowColumnEnclosure')}').attr('readonly', true);"; $beforeUploadAction .= "\$('#{$this->getEditableInputId('rowColumnEnclosure')}').addClass('readonly-field');"; $afterDeleteAction = "\$('#{$this->getEditableInputId('rowColumnDelimiter')}').removeAttr('readonly');"; $afterDeleteAction .= "\$('#{$this->getEditableInputId('rowColumnDelimiter')}').removeClass('readonly-field');"; $afterDeleteAction .= "\$('#{$this->getEditableInputId('rowColumnEnclosure')}').removeAttr('readonly');"; $afterDeleteAction .= "\$('#{$this->getEditableInputId('rowColumnEnclosure')}').removeClass('readonly-field');"; $cClipWidget = new CClipWidget(); $cClipWidget->beginClip("filesElement"); $cClipWidget->widget('application.core.widgets.FileUpload', array('uploadUrl' => Yii::app()->createUrl("import/default/uploadFile", array('filesVariableName' => $inputNameAndId, 'id' => $this->model->id)), 'deleteUrl' => Yii::app()->createUrl("import/default/deleteFile"), 'inputName' => $inputNameAndId, 'inputId' => $inputNameAndId, 'hiddenInputName' => 'fileId', 'formName' => $this->form->id, 'existingFiles' => $existingFilesInformation, 'maxSize' => (int) InstallUtil::getMaxAllowedFileSize(), 'beforeUploadAction' => $beforeUploadAction, 'afterDeleteAction' => $afterDeleteAction)); $cClipWidget->endClip(); $content .= '<tr><td></td><td colspan="3"><div class="file-upload-box">' . $cClipWidget->getController()->clips['filesElement'] . '</div></td></tr>'; return $content; }
protected function renderImagesUploadInput() { $inputNameAndId = 'file'; $cClipWidget = new CClipWidget(); $cClipWidget->beginClip("imageFilesElement"); $cClipWidget->widget('application.core.widgets.ImageFileUpload', array('uploadUrl' => Yii::app()->createUrl("zurmo/imageModel/upload"), 'deleteUrl' => Yii::app()->createUrl("zurmo/imageModel/delete"), 'inputName' => $inputNameAndId, 'inputId' => $inputNameAndId, 'hiddenInputName' => 'filesIds', 'allowMultipleUpload' => true, 'existingFiles' => array(), 'maxSize' => (int) InstallUtil::getMaxAllowedFileSize(), 'showMaxSize' => true, 'id' => __CLASS__, 'onSuccessAction' => "\$('#{$this->listViewGridId}').yiiGridView('update');", 'formData' => "{'" . Yii::app()->request->csrfTokenName . "' : '" . Yii::app()->request->csrfToken . "'}")); $cClipWidget->endClip(); return $cClipWidget->getController()->clips['imageFilesElement']; }
protected function checkService() { $passed = InstallUtil::isPdoInstalled(); if ($passed) { $this->message = Zurmo::t('InstallModule', 'pdo is installed.'); } else { $this->message = Zurmo::t('InstallModule', 'pdo is not installed.'); } return $passed; }
protected function checkService() { $passed = true; if (!InstallUtil::isFileUploadsOn()) { $this->message = Zurmo::t('InstallModule', 'PHP file_uploads is Off. This should be on.'); $passed = false; } else { $this->message = Zurmo::t('InstallModule', 'PHP file_uploads is on which is ok.'); } return $passed; }
protected function checkService() { $passed = false; if (InstallUtil::checkDatabaseLoadLocalInFile('mysql', $this->form->databaseHostname, $this->form->databaseUsername, $this->form->databasePassword, $this->form->databasePort)) { $this->message = Zurmo::t('InstallModule', 'Database supports LOAD LOCAL INFILE.'); $passed = true; } else { $this->message = Zurmo::t('InstallModule', 'Database does not support LOAD LOCAL INFILE.'); } return $passed; }
protected function checkService() { $isMcryptInstalled = InstallUtil::isMcryptInstalled(); if ($isMcryptInstalled) { $this->message = Zurmo::t('InstallModule', 'Mcrypt extension is loaded.'); return true; } else { $this->message = Zurmo::t('InstallModule', 'Mcrypt extension is not loaded.'); return false; } }
protected function checkService() { $ctypeInstalled = InstallUtil::checkCtype(); if ($ctypeInstalled) { $this->message = Zurmo::t('InstallModule', 'Ctype extension is loaded.'); return true; } else { $this->message = Zurmo::t('InstallModule', 'Ctype extension is not loaded.'); return false; } }
protected function checkService() { $allPassed = false; if (InstallUtil::checkPhpTimezoneSetting()) { $this->message = Zurmo::t('InstallModule', 'PHP date.timezone is set.'); return true; } else { $this->message = Zurmo::t('InstallModule', 'PHP date.timezone is not set.'); return true; } }
protected function checkService() { $soapInstalled = InstallUtil::checkSoap(); if ($soapInstalled) { $this->message = Zurmo::t('InstallModule', 'SOAP is installed.'); return true; } else { $this->message = Zurmo::t('InstallModule', 'SOAP is not installed.'); return false; } }
/** * test create system user */ public function testCreateSystemUser() { $user = InstallUtil::createSystemUser('testsystemuser', 'test'); $id = $user->id; $user->forget(); unset($user); $user = User::getById($id); $this->assertTrue((bool) $user->isSystemUser); $this->assertTrue((bool) $user->hideFromSelecting); $this->assertTrue((bool) $user->hideFromLeaderboard); }
public function getListContents($iRowStart = 0, $iRowCount = null) { $aResult = array(); $aInstaller = InstallUtil::loadYamlFile(BASE_DIR . '/' . DIRNAME_MODULES . '/admin/installer/installer_options.yml'); foreach ($aInstaller['options'] as $sSectionName => $aOptions) { $aResult[] = array('action' => $sSectionName, 'title' => TranslationPeer::getString('wns.backup.' . $sSectionName, null, StringUtil::makeReadableName($sSectionName))); } if ($iRowCount === null) { $iRowCount = count($aResult); } return array_splice($aResult, $iRowStart, $iRowCount); }
protected function checkService() { $message = ''; $serverVariableAccesible = InstallUtil::checkServerVariable($message); if ($serverVariableAccesible) { $this->message = Zurmo::t('InstallModule', '$_SERVER is accessible.'); return true; } else { $this->message = $message; return false; } }
public function testRun() { $this->assertTrue(ContactsModule::loadStartingData()); $messageLogger = new MessageLogger(); InstallUtil::autoBuildDatabase($messageLogger); chdir(COMMON_ROOT . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'commands'); $command = "php zurmocTest.php jobManager super ExportCleanup"; if (!IS_WINNT) { $command .= ' 2>&1'; } exec($command, $output); $this->assertTrue(array_search('Info - Job completed successfully', $output) !== false); }
/** * When running a special action or a job an elevated user must be used in order to ensure the activities can * be processed properly. * @param boolean $createIfMissing creates system user if its missing * @return User $user * @throws NotFoundException if backend user can not be found and $createIfMissing is false */ public static function getUserToRunAs($createIfMissing = true) { try { $user = User::getByUsername(static::USERNAME); } catch (NotFoundException $e) { if ($createIfMissing) { $user = InstallUtil::createBaseControlUserConfigUtilUserAccount(); } else { throw new NotFoundException("Backend User: "******" was not found."); } } return $user; }
public function testRun() { $this->assertTrue(ContactsModule::loadStartingData()); $messageLogger = new MessageLogger(); InstallUtil::autoBuildDatabase($messageLogger); chdir(COMMON_ROOT . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'commands'); $command = "php zurmocTest.php updateSchema super"; if (!IS_WINNT) { $command .= ' 2>&1'; } exec($command, $output); $this->assertTrue(array_search('Info - Auto built Account saved.', $output) !== false); $this->assertTrue(array_search('Schema update complete.', $output) !== false); }
public function testRun() { $this->assertTrue(ContactsModule::loadStartingData()); $messageLogger = new MessageLogger(); InstallUtil::autoBuildDatabase($messageLogger, true); chdir(COMMON_ROOT . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'commands'); $command = "php zurmocTest.php jobManager super ExportCleanup"; if (!IS_WINNT) { $command .= ' 2>&1'; } exec($command, $output); $this->assertContains('Sending output to', $output[2]); $this->assertContains('ExportCleanup.log', $output[2]); }
protected function renderControlEditable() { assert('$this->model instanceof Item || $this->model->getModel() instanceof Item'); $existingFilesInformation = array(); foreach ($this->model->files as $existingFile) { $existingFilesInformation[] = array('name' => $existingFile->name, 'size' => FileModelDisplayUtil::convertSizeToHumanReadableAndGet((int) $existingFile->size), 'id' => $existingFile->id); } $inputNameAndId = $this->getEditableInputId('files'); $cClipWidget = new CClipWidget(); $cClipWidget->beginClip("filesElement"); $cClipWidget->widget('application.core.widgets.FileUpload', array('uploadUrl' => Yii::app()->createUrl("zurmo/fileModel/upload", array('filesVariableName' => $inputNameAndId)), 'deleteUrl' => Yii::app()->createUrl("zurmo/fileModel/delete"), 'inputName' => $inputNameAndId, 'inputId' => $inputNameAndId, 'hiddenInputName' => 'filesIds', 'formName' => $this->form->id, 'allowMultipleUpload' => true, 'existingFiles' => $existingFilesInformation, 'maxSize' => (int) InstallUtil::getMaxAllowedFileSize(), 'showMaxSize' => $this->getShowMaxSize(), 'id' => $this->getId())); $cClipWidget->endClip(); return $cClipWidget->getController()->clips['filesElement']; }
protected function preFilter($filterChain) { if (isset($_POST['ajax'])) { return true; } $isLdapExtensionLoaded = InstallUtil::isLdapInstalled(); if ($isLdapExtensionLoaded) { return true; } $messageView = new NoLdapExtensionLoadedView(); $pageViewClassName = $this->controller->getModule()->getPluralCamelCasedName() . 'PageView'; $view = new $pageViewClassName(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this->controller, $messageView)); echo $view->render(); return false; }
protected function checkService() { $actualMemoryBytes = null; $memoryBytesPassed = InstallUtil::checkPhpMaxMemorySetting($this->minimumMemoryRequireBytes, $actualMemoryBytes); if ($memoryBytesPassed) { $this->message = Zurmo::t('InstallModule', 'PHP memory_limit meets minimum requirement.'); return true; } else { $this->message = Zurmo::t('InstallModule', 'PHP memory_limit is:') . ' '; $this->message .= round($actualMemoryBytes / 1024000) . 'M '; $this->message .= Zurmo::t('InstallModule', 'minimum requirement is:') . ' '; $this->message .= round($this->minimumMemoryRequireBytes / 1024000) . 'M'; return false; } }
protected function checkService() { $passed = true; $actualUploadSizeBytes = null; $uploadSizeBytesPassed = InstallUtil::checkPhpUploadSizeSetting($this->minimumUploadRequireBytes, $actualUploadSizeBytes); if ($uploadSizeBytesPassed) { $this->message = Zurmo::t('InstallModule', 'PHP upload_max_filesize value meets minimum requirement.'); } else { $this->message = Zurmo::t('InstallModule', 'PHP upload_max_filesize value is:') . ' '; $this->message .= round($actualUploadSizeBytes / 1024000) . 'M '; $this->message .= Zurmo::t('InstallModule', 'minimum requirement is:') . ' '; $this->message .= round($this->minimumUploadRequireBytes / 1024000) . 'M'; $passed = false; } return $passed; }
protected function renderControlEditable() { // assert('$this->model instanceof ZurmoUserInterfaceConfigurationForm'); $existingFilesInformation = array(); if (!empty($this->model->logoFileData)) { $existingFilesInformation[] = $this->model->logoFileData; $existingFilesInformation[0]['id'] = $this->model->id; } $inputNameAndId = $this->getEditableInputId('logo'); $cClipWidget = new CClipWidget(); $cClipWidget->beginClip("logoFileElement"); $cClipWidget->widget('application.core.widgets.LogoFileUpload', array('uploadUrl' => Yii::app()->createUrl("zurmo/default/uploadLogo", array('filesVariableName' => $inputNameAndId)), 'deleteUrl' => Yii::app()->createUrl("zurmo/default/deleteLogo"), 'inputName' => $inputNameAndId, 'inputId' => $inputNameAndId, 'hiddenInputName' => 'logoFileName', 'formName' => $this->form->id, 'existingFiles' => $existingFilesInformation, 'maxSize' => (int) InstallUtil::getMaxAllowedFileSize(), 'beforeUploadAction' => null, 'afterDeleteAction' => null)); $cClipWidget->endClip(); $content = '<div class="file-upload-box">' . $cClipWidget->getController()->clips['logoFileElement'] . '</div>'; return $content; }
protected function checkService() { $passed = true; $optimizerSearchDepth = null; if (!InstallUtil::checkDatabaseOptimizerSearchDepthValue('mysql', $this->form->databaseHostname, $this->form->databaseUsername, $this->form->databasePassword, $this->form->databasePort, $optimizerSearchDepth)) { if ($optimizerSearchDepth == null) { $this->message = Zurmo::t('InstallModule', 'Could not get value of database optimizer_search_depth.'); } else { $this->message = Zurmo::t('InstallModule', 'Database optimizer_search_depth value is {searchDepth}. ' . 'It is required to be set to 0.', array('{searchDepth}' => $optimizerSearchDepth)); } $passed = false; } else { $this->message = Zurmo::t('InstallModule', 'Database optimizer_search_depth size meets requirement.'); } return $passed; }
protected function checkService() { $passed = true; $threadStackValue = null; if (!InstallUtil::checkDatabaseThreadStackValue('mysql', $this->form->databaseHostname, $this->form->databaseUsername, $this->form->databasePassword, $this->form->databasePort, $this->minimumRequiredThreadStackValue, $threadStackValue)) { if ($threadStackValue == null) { $this->message = Zurmo::t('InstallModule', 'Could not get value of database thread_stack.'); } else { $this->message = Zurmo::t('InstallModule', 'Database thread_stack value is:') . ' '; $this->message .= $threadStackValue . ' '; $this->message .= Zurmo::t('InstallModule', 'minimum requirement is:') . ' '; $this->message .= $this->minimumRequiredThreadStackValue; } $passed = false; } else { $this->message = Zurmo::t('InstallModule', 'Database thread_stack value meets minimum requirement.'); } return $passed; }
protected function checkService() { $passed = true; $maxSpRecursionDepth = null; if (!InstallUtil::checkDatabaseMaxSpRecursionDepth('mysql', $this->form->databaseHostname, $this->form->databaseUsername, $this->form->databasePassword, $this->form->databasePort, $this->minimumRequiredMaxSpRecursionDepth, $maxSpRecursionDepth)) { if ($maxSpRecursionDepth == null) { $this->message = Zurmo::t('InstallModule', 'Could not get value of database max_sp_recursion_depth.'); } else { $this->message = Zurmo::t('InstallModule', 'Database max_sp_recursion_depth size is:') . ' '; $this->message .= $maxSpRecursionDepth . ' '; $this->message .= Zurmo::t('InstallModule', 'minimum requirement is:') . ' '; $this->message .= $this->minimumRequiredMaxSpRecursionDepth; } $passed = false; } else { $this->message = Zurmo::t('InstallModule', 'Database max_sp_recursion_depth size meets minimum requirement.'); } return $passed; }
protected function checkService() { $passed = true; $actualBytes = null; if (!InstallUtil::checkDatabaseMaxAllowedPacketsSize('mysql', $this->form->databaseHostname, $this->form->databaseUsername, $this->form->databasePassword, $this->form->databasePort, $this->minimumUploadRequireBytes, $actualBytes)) { if ($actualBytes == null) { $this->message = Zurmo::t('InstallModule', 'Could not get value of database max_allowed_packet.'); } else { $this->message = Zurmo::t('InstallModule', 'Database max_allowed_packet size is:') . ' '; $this->message .= round($actualBytes / 1024000) . 'M '; $this->message .= Zurmo::t('InstallModule', 'minimum requirement is:') . ' '; $this->message .= round($this->minimumUploadRequireBytes / 1024000) . 'M'; } $passed = false; } else { $this->message = Zurmo::t('InstallModule', 'Database max_allowed_packet size meets minimum requirement.'); } return $passed; }
protected function checkService() { $passed = true; $debugWritable = InstallUtil::isDebugConfigWritable(INSTANCE_ROOT); if ($debugWritable) { $this->message = Zurmo::t('InstallModule', 'The debug.php config file is writable.'); } else { $this->message = Zurmo::t('InstallModule', 'The debug.php config file is not writable.'); $passed = false; } $perInstanceWritable = InstallUtil::isPerInstanceConfigWritable(INSTANCE_ROOT); if ($perInstanceWritable) { $this->message .= "\n" . Zurmo::t('InstallModule', 'The perInstance.php config file is writable.'); } else { $this->message .= "\n" . Zurmo::t('InstallModule', 'The perInstance.php config file is not writable.'); $passed = false; } return $passed; }
protected function checkService() { $passed = true; $databaseDefaultCollation = null; if (!InstallUtil::checkDatabaseDefaultCollation('mysql', $this->form->databaseHostname, $this->form->databaseName, $this->form->databaseUsername, $this->form->databasePassword, $this->form->databasePort, $this->notAllowedDatabaseCollations, $databaseDefaultCollation)) { if ($databaseDefaultCollation != null) { $notAllowedCollations = implode(', ', $this->notAllowedDatabaseCollations); $this->message = Zurmo::t('InstallModule', 'Database default collation is: {collation}', array('{collation}' => $databaseDefaultCollation)); $this->message .= ' . '; $this->message .= Zurmo::t('InstallModule', 'Database default collation should not be in: {listOfCollations}', array('{listOfCollations}' => $notAllowedCollations)); } else { $this->message = Zurmo::t('InstallModule', 'Could not get value of database default collation.'); } $passed = false; } else { $this->message = Zurmo::t('InstallModule', 'Database default collation meets minimum requirement.'); } return $passed; }