示例#1
1
 /**
  *
  * @param PWECore $PWE
  * @param bool $forceNewConnection
  * @param string $alias
  * @return Connection
  * @throws DBALException
  */
 public static function getConnection(PWECore $PWE, $forceNewConnection = false, $alias = null)
 {
     if (!$forceNewConnection && self::$connection[$alias]) {
         PWELogger::debug('Used cached connection');
         return self::$connection[$alias];
     }
     $settings = $PWE->getModulesManager()->getModuleSettings(self::getClass());
     $connections = $settings['!c']['connection'];
     $ix = PWEXMLFunctions::findNodeWithAttributeValue($connections, 'alias', $alias);
     if ($ix < 0) {
         throw new \InvalidArgumentException("Alias {$alias} not found in database configs");
     }
     $params = $connections[$ix]['!a'];
     $config = new Configuration();
     $config->setSQLLogger(new PWEDoctrineLogger($alias ? $alias : ''));
     PWELogger::debug("Getting connection: %s", $params);
     self::$connection[$alias] = DriverManager::getConnection($params, $config);
     return self::$connection[$alias];
 }
示例#2
0
 public static function setup(PWECore $pwe, array &$registerData)
 {
     if (is_writable($pwe->getStaticDirectory())) {
         PWELogger::debug("Copying into %s/design", $pwe->getStaticDirectory());
         FilesystemHelper::fsys_copydir(__DIR__ . '/../../design', $pwe->getStaticDirectory() . '/design');
     } else {
         PWELogger::warn("Can't copy resources to %s, it's not writable");
     }
 }
示例#3
0
 /**
  * @param \PWE\Core\PWECore $pwe
  * @return PWEUserAuthController
  */
 public static function getAuthControllerInstance(PWECore $pwe)
 {
     try {
         $node = $pwe->getNode();
     } catch (HTTP5xxException $e) {
         PWELogger::warn('Failed to get pwe node in auth controller: %s', $e);
     }
     if (!isset($node['!i']['authController']) || $node['!i']['authController'] == 'none') {
         return new NoneAuthController($pwe);
     }
     if ($node['!i']['authController'] != NoneAuthController::getClassName()) {
         PWELogger::info('Page requires auth: %s', $node['!i']['authController']);
     }
     return new $node['!i']['authController']($pwe);
 }
示例#4
0
 public function run()
 {
     $this->setRegistryFile($this->PWE->getModulesManager()->getRegistryFile());
     PWELogger::debug("Dumping config");
     $this->loadRegistry();
     $this->xml_as_options($this->registryArray);
 }
示例#5
0
 public function __construct()
 {
     parent::__construct();
     $this->setXMLDirectory(__DIR__);
     $this->setTempDirectory('/tmp');
     $this->modulesManager = new CMDLineModulesManager($this);
 }
示例#6
0
 public function setURL($uri)
 {
     parent::setURL($uri);
 }
示例#7
0
文件: HTMLPage.php 项目: undera/pwe
 private static function getHTMLDirectory(PWECore $pwe)
 {
     return $pwe->getDataDirectory() . '/html';
 }
示例#8
0
 public function getModulesManager()
 {
     try {
         return parent::getModulesManager();
     } catch (BadFunctionCallException $e) {
         return null;
     }
 }
示例#9
0
文件: PWEXML.php 项目: undera/pwe
 public static function setup(PWECore $pwe, array &$registerData)
 {
     if (!$registerData['!c']['cacheDir']) {
         $registerData['!c']['cacheDir'][0]['!v'] = $pwe->getTempDirectory();
     }
 }