.
\ No newline at end of file
diff --git a/application/Espo/Core/Utils/File/Permission.php b/application/Espo/Core/Utils/File/Permission.php
index e142bfda5e..6ec4651c78 100644
--- a/application/Espo/Core/Utils/File/Permission.php
+++ b/application/Espo/Core/Utils/File/Permission.php
@@ -5,7 +5,7 @@ namespace Espo\Core\Utils\File;
use Espo\Core\Utils;
class Permission
-{
+{
protected $params = array(
'defaultPermissions' => array (
'dir' => '0775',
@@ -20,7 +20,7 @@ class Permission
{
if (isset($params)) {
$this->params = $params;
- }
+ }
}
protected function getParams()
@@ -36,10 +36,10 @@ class Permission
*/
public function getDefaultPermissions()
{
- $params = $this->getParams();
+ $params = $this->getParams();
return $params['defaultPermissions'];
}
-
+
/**
* Set default permission
@@ -157,16 +157,17 @@ class Permission
*
* @return bool
*/
- protected function chmodRecurse($path, $fileOctal=0644, $dirOctal=0755)
+ protected function chmodRecurse($path, $fileOctal = 0644, $dirOctal = 0755)
{
if (!file_exists($path)) {
return false;
}
if (is_file($path)) {
- chmod($path, $fileOctal);
+ return chmod($path, $fileOctal);
}
- elseif (is_dir($path)) {
+
+ if (is_dir($path)) {
$allFiles = scandir($path);
$items = array_slice($allFiles, 2);
@@ -174,10 +175,10 @@ class Permission
$this->chmodRecurse($path. Utils\Util::getSeparator() .$item, $fileOctal, $dirOctal);
}
- $this->chmodReal($path, $dirOctal);
+ return $this->chmodReal($path, $dirOctal);
}
- return true;
+ return false;
}
@@ -235,11 +236,11 @@ class Permission
* Change owner permission recirsive
*
* @param string $path
- * @param string $user
+ * @param string $user
*
* @return bool
*/
- protected function chownRecurse($path, $user)
+ protected function chownRecurse($path, $user)
{
if (!file_exists($path)) {
return false;
diff --git a/application/Espo/Core/defaults/config.php b/application/Espo/Core/defaults/config.php
index 9b4b96589c..9450c52803 100644
--- a/application/Espo/Core/defaults/config.php
+++ b/application/Espo/Core/defaults/config.php
@@ -5,12 +5,17 @@ return array (
'cachePath' => 'data/cache',
+ 'database' =>
+ array (
+ 'driver' => 'pdo_mysql',
+ 'host' => 'localhost',
+ ),
'logger' =>
array (
'path' => 'data/logs/espo.log',
- 'level' => 'DEBUG', /*DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY*/
+ 'level' => 'ERROR', /*DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY*/
'isRotate' => true, /*rotate every day every logs files*/
- 'maxRotateFiles' => 60, /*max number of rotate files*/
+ 'maxRotateFiles' => 30, /*max number of rotate files*/
),
'defaultPermissions' =>
diff --git a/test.php b/test.php
deleted file mode 100644
index f6824ad096..0000000000
--- a/test.php
+++ /dev/null
@@ -1,299 +0,0 @@
-getContainer()->get('fileManager');
-//$GLOBALS['log']->error('My Custom Error');
-
-
-echo '';
-print_r($fm->putContents('tests/taras/test/me/ggg.json', '{"data":"dddd"}'));
-
-
-
-exit;
-
-
-$user = $app->getContainer()->get('entityManager')->getRepository('User')->findOne(array(
- 'whereClause' => array(
- 'userName' => 'admin',
- ),
- ));
-$app->getContainer()->setUser($user);
-
-
-$i18n = $app->getContainer()->get('i18n');
-
-echo '';
-//print_r( $i18n->get() );
-var_dump( $i18n->get() );
-
-
-exit;
-
-
-echo '';
-//var_dump( $app->getContainer()->get('metadata')->get('app.adminPanel.system') );
-var_dump( $app->getContainer()->get('metadata')->get('app.adminPanel.system.label') );
-//print_r( $app->getContainer()->get('metadata')->get() );
-
-
-exit;
-
-
-/*$cron = Cron\CronExpression::factory('53 * * * *');
-var_dump($cron->isDue()).'
';
-
-echo date('Y-m-d H:i:s').']]
';
-
-echo 'Next= '.$cron->getNextRunDate()->format('Y-m-d H:i:s').'
';
-echo 'Prev= '.$cron->getPreviousRunDate()->format('Y-m-d H:i:s');
-
-exit;*/
-
-
-
-/*$entryPoint = new \Espo\Core\EntryPointManager($app->getContainer());
-$entryPoint->run('Download');
-
-exit;*/
-
-
-
-$user = $app->getContainer()->get('entityManager')->getRepository('User')->findOne(array(
- 'whereClause' => array(
- 'userName' => 'admin',
- ),
- ));
-$app->getContainer()->setUser($user);
-
-
-//$cronManager = new \Espo\Core\CronManager( $app->getContainer()->get('serviceFactory'), $app->getContainer()->get('config'), $app->getContainer()->get('fileManager') );
-$cronManager = new \Espo\Core\CronManager( $app->getContainer() );
-echo $cronManager->run();
-
-
-exit;
-
-//dddhhh
-echo time().'
';
-
-echo '';
-print_r();
-exit;
-
-
-/*$cron = Cron\CronExpression::factory('@daily');
-echo $cron->isDue();
-echo $cron->getNextRunDate()->format('Y-m-d H:i:s').'
';
-echo $cron->getPreviousRunDate()->format('Y-m-d H:i:s');
-
-exit;*/
-
-//$cron = Cron\CronExpression::factory('3-59/15 2,6-12 */15 1 2-5');
-$cron = Cron\CronExpression::factory('24 * * * *');
-var_dump($cron->isDue()).'
';
-//var_dump(isInRange($cron, '2014-01-28 12:00:00', '2014-01-28 13:00:00')).'
';
-var_dump(isInRange($cron, '1 hour')).'
';
-
-echo date('Y-m-d H:i:s').']]
';
-
-echo $cron->getNextRunDate()->format('Y-m-d H:i:s').'
';
-echo $cron->getPreviousRunDate()->format('Y-m-d H:i:s');
-
-
-
-function isInRange($cron, $period = '30 minutes')
-{
- $startDateTimestamp = strtotime($period);
- $endDateTimestamp = strtotime('-'.$period);
- $cronDateTimestamp = $cron->getNextRunDate($currentDate, 0, true)->getTimestamp();
-
- echo '
*********
';
- echo date('Y-m-d H:i:s', $startDateTimestamp).'
';
- echo date('Y-m-d H:i:s', $endDateTimestamp).'
';
- echo date('Y-m-d H:i:s', $cronDateTimestamp).'
';
- echo '*********
';
-
- if ($cronDateTimestamp >= $startDateTimestamp && $cronDateTimestamp <= $endDateTimestamp) {
- return true;
- }
-
- return false;
-}
-
-/*function isInRange($cron, $startDate, $endDate)
-{
- $startDateTimestamp = strtotime($startDate);
- $endDateTimestamp = strtotime($endDate);
- $cronDateTimestamp = $cron->getNextRunDate($currentDate, 0, true)->getTimestamp();
-
- if ($cronDateTimestamp >= $startDateTimestamp && $cronDateTimestamp <= $endDateTimestamp) {
- return true;
- }
-
- return false;
-}*/
-//********************************************************************************************/
-exit;
-
-
-$app->getSlim()->get('/', function() {});
-$app->getSlim()->run();
-
-echo 'ooooo';
-
-exit;
-
-
-$entryPoint = $app->getContainer()->get('entryPointManager')->getAll();
-
-
-echo '';
-print_r($entryPoint);
-
-
-exit;
-
-/*$route = new \Espo\Core\Utils\Route($app->getContainer()->get('config'), $app->getContainer()->get('fileManager'));
-
-echo '';
-print_r($route->get('0.route'));
-
-exit; */
-
-//$entity = $app->getContainer()->get('entityManager')->getRepository('User')->findOne(array('userName' => 'admin'));
-$entity = $app->getContainer()
- ->get('entityManager')
- ->getRepository('User')
- ->findOne(array(
- 'whereClause' => array(
- 'userName' => 'admin',
- ),
- )
- );
-
-//$currentUser = $app->getContainer()->get('user');
-
-
-
-echo '';
-print_r($entity);
-//print_r($currentUser);
-
-
-
-//******************************************************************************
-exit;
-$espoSchema = new \Espo\Core\Utils\Database\Schema($app->getContainer()->get('config'), $app->getMetadata(), $app->getContainer()->get('fileManager'));
-
-$db= $espoSchema->getConnection();
-
-$sm = $db->getSchemaManager();
-
-$schema = new \Doctrine\DBAL\Schema\Schema();
-//$schema = $sm->createSchema();
-//$schema = new \Espo\Core\Database\Schema();
-$myTable = $schema->createTable("my_table");
-$myTable->addColumn("id", "integer", array("unsigned" => true));
-$myTable->addColumn("username", "varchar", array("length" => 32, "default" => "admin",));
-$myTable->addColumn("test", "varchar", array("length" => 32));
-$myTable->setPrimaryKey(array("id"));
-
-
-
-$myPlatform = $db->getDatabasePlatform();
-
-$queries = $schema->toSql($myPlatform); // get queries to create this schema.
-//$dropSchema = $schema->toDropSql($myPlatform); // get queries to safely delete this schema.
-
-
-//print_r(\Doctrine\DBAL\Types\Type::getTypesMap());
-//print_r($queries);
-
-//exit;
-
-echo '';
-//print_r($queries);
-
-//print_r($dropSchema);
-//exit;
-
-
-//exit;
-
-$fromSchema = $sm->createSchema();
-
-
-//print_r($schema);
-//exit;
-
-$comparator = new \Doctrine\DBAL\Schema\Comparator();
-$schemaDiff = $comparator->compare($fromSchema, $schema);
-
-$queries = $schemaDiff->toSql($myPlatform); // queries to get from one to another schema.
-$saveQueries = $schemaDiff->toSaveSql($myPlatform);
-
-
-//$espoSchema->getConnection()->executeQuery($saveQueries);
-
-
-print_r($queries);
-print_r($saveQueries);
-
-exit;
-
-echo '';
-//var_dump( $app->getContainer()->get('metadata')->get('app.adminPanel.system') );
-var_dump( $app->getContainer()->get('metadata')->get('app.adminPanel.system.label') );
-//print_r( $app->getContainer()->get('metadata')->get() );
-
-
-exit;
-
-
-//echo $app->getContainer()->get('entityManager')->getRepository('Espo\Entities\User')->isAdmin();
-
-echo '';
-print_r( $app->getContainer()->get('entityManager')->getRepository('Espo\Entities\User')->findOneBy(array('username' => 'admin')) );
-exit;
-
-//$user = $app->getContainer()->get('entityManager')->getRepository('\Espo\Entities\User')->findOneBy(array('username' => 'admin'));
-$user = $app->getContainer()->get('entityManager')->getRepository('\Espo\Entities\User');
-
-//$user = new \Espo\Entities\User();
-
-
-echo '[[[';
-print_r($user);
-
-echo '
[';
-echo $user->isAdmin();
-
-
-//$user = $this->entityManager->getRepository('\Espo\Entities\User')->findOneBy(array('username' => $username));
-
-
-
-$app->getContainer()->get('entityManager')->getRepository('Espo\Entities\User')->isAdmin();
-
-
-
-
-
-
-
-
-?>