Linux anchor 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
Apache/2.4.18 (Ubuntu)
Server IP : 10.10.100.4 & Your IP : 216.73.217.150
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
owncloud-prm /
lib /
private /
DB /
Delete
Unzip
Name
Size
Permission
Date
Action
QueryBuilder
[ DIR ]
drwxr-xr-x
2018-04-19 18:15
Adapter.php
6.45
KB
-rw-r--r--
2018-04-19 18:15
AdapterMySQL.php
1.39
KB
-rw-r--r--
2018-04-19 18:15
AdapterOCI8.php
1.83
KB
-rw-r--r--
2018-04-19 18:15
AdapterPgSql.php
1.23
KB
-rw-r--r--
2018-04-19 18:15
AdapterSqlite.php
2.97
KB
-rw-r--r--
2018-04-19 18:15
Connection.php
14.32
KB
-rw-r--r--
2018-04-19 18:15
ConnectionFactory.php
7.06
KB
-rw-r--r--
2018-04-19 18:15
MDB2SchemaManager.php
5.44
KB
-rw-r--r--
2018-04-19 18:15
MDB2SchemaReader.php
8.49
KB
-rw-r--r--
2018-04-19 18:15
MDB2SchemaWriter.php
5.36
KB
-rw-r--r--
2018-04-19 18:15
MigrationException.php
1.05
KB
-rw-r--r--
2018-04-19 18:15
MigrationService.php
10.27
KB
-rw-r--r--
2018-04-19 18:15
Migrator.php
7.57
KB
-rw-r--r--
2018-04-19 18:15
MySQLMigrator.php
2.8
KB
-rw-r--r--
2018-04-19 18:15
MySqlSchemaColumnDefinitionListener.php
7.53
KB
-rw-r--r--
2018-04-19 18:15
MySqlTools.php
1.37
KB
-rw-r--r--
2018-04-19 18:15
OCPostgreSqlPlatform.php
2.97
KB
-rw-r--r--
2018-04-19 18:15
OCSqlitePlatform.php
1.49
KB
-rw-r--r--
2018-04-19 18:15
OracleConnection.php
3.09
KB
-rw-r--r--
2018-04-19 18:15
OracleMigrator.php
6.21
KB
-rw-r--r--
2018-04-19 18:15
PgSqlTools.php
2.23
KB
-rw-r--r--
2018-04-19 18:15
PostgreSqlMigrator.php
1.81
KB
-rw-r--r--
2018-04-19 18:15
SQLiteMigrator.php
2.21
KB
-rw-r--r--
2018-04-19 18:15
SQLiteSessionInit.php
1.82
KB
-rw-r--r--
2018-04-19 18:15
Save
Rename
<?php /** * @author Andreas Fischer <bantu@owncloud.com> * @author Jörn Friedrich Dreyer <jfd@butonic.de> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <icewind@owncloud.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @copyright Copyright (c) 2018, ownCloud GmbH * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ namespace OC\DB; use Doctrine\Common\EventManager; use Doctrine\DBAL\Configuration; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Event\Listeners\OracleSessionInit; use Doctrine\DBAL\Event\Listeners\SQLSessionInit; use Doctrine\DBAL\Events; use OC\SystemConfig; /** * Takes care of creating and configuring Doctrine connections. */ class ConnectionFactory { /** * @var array * * Array mapping DBMS type to default connection parameters passed to * \Doctrine\DBAL\DriverManager::getConnection(). */ protected $defaultConnectionParams = [ 'mysql' => [ 'adapter' => '\OC\DB\AdapterMySQL', 'charset' => 'UTF8', 'driver' => 'pdo_mysql', 'wrapperClass' => 'OC\DB\Connection', ], 'oci' => [ 'adapter' => '\OC\DB\AdapterOCI8', 'charset' => 'AL32UTF8', 'driver' => 'oci8', 'wrapperClass' => 'OC\DB\OracleConnection', ], 'pgsql' => [ 'adapter' => '\OC\DB\AdapterPgSql', 'driver' => 'pdo_pgsql', 'wrapperClass' => 'OC\DB\Connection', ], 'sqlite3' => [ 'adapter' => '\OC\DB\AdapterSqlite', 'driver' => 'pdo_sqlite', 'wrapperClass' => 'OC\DB\Connection', ], ]; /** @var SystemConfig */ private $config; /** * ConnectionFactory constructor. * * @param SystemConfig $systemConfig */ public function __construct(SystemConfig $systemConfig) { $this->config = $systemConfig; if($this->config->getValue('mysql.utf8mb4', false)) { $this->defaultConnectionParams['mysql']['charset'] = 'utf8mb4'; } } /** * @brief Get default connection parameters for a given DBMS. * @param string $type DBMS type * @throws \InvalidArgumentException If $type is invalid * @return array Default connection parameters. */ public function getDefaultConnectionParams($type) { $normalizedType = $this->normalizeType($type); if (!isset($this->defaultConnectionParams[$normalizedType])) { throw new \InvalidArgumentException("Unsupported type: $type"); } $result = $this->defaultConnectionParams[$normalizedType]; // \PDO::MYSQL_ATTR_FOUND_ROWS may not be defined, e.g. when the MySQL // driver is missing. In this case, we won't be able to connect anyway. if ($normalizedType === 'mysql' && defined('\PDO::MYSQL_ATTR_FOUND_ROWS')) { $result['driverOptions'] = [ \PDO::MYSQL_ATTR_FOUND_ROWS => true, ]; } return $result; } /** * @brief Get default connection parameters for a given DBMS. * @param string $type DBMS type * @param array $additionalConnectionParams Additional connection parameters * @return \OC\DB\Connection */ public function getConnection($type, $additionalConnectionParams) { $normalizedType = $this->normalizeType($type); $eventManager = new EventManager(); switch ($normalizedType) { case 'mysql': $eventManager->addEventSubscriber( new SQLSessionInit("SET SESSION AUTOCOMMIT=1")); $eventManager->addEventListener( Events::onSchemaColumnDefinition, new MySqlSchemaColumnDefinitionListener() ); break; case 'oci': $eventManager->addEventSubscriber(new OracleSessionInit); // the driverOptions are unused in dbal and need to be mapped to the parameters if (isset($additionalConnectionParams['driverOptions'])) { $additionalConnectionParams = array_merge($additionalConnectionParams, $additionalConnectionParams['driverOptions']); } break; case 'sqlite3': $journalMode = $additionalConnectionParams['sqlite.journal_mode']; $additionalConnectionParams['platform'] = new OCSqlitePlatform(); $eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode)); break; case 'pgsql': $additionalConnectionParams['platform'] = new OCPostgreSqlPlatform(); break; } /** @var Connection $connection */ $connection = DriverManager::getConnection( array_merge($this->getDefaultConnectionParams($type), $additionalConnectionParams), new Configuration(), $eventManager ); return $connection; } /** * @brief Normalize DBMS type * @param string $type DBMS type * @return string Normalized DBMS type */ public function normalizeType($type) { return $type === 'sqlite' ? 'sqlite3' : $type; } /** * Checks whether the specified DBMS type is valid. * * @param string $type * @return bool */ public function isValidType($type) { $normalizedType = $this->normalizeType($type); return isset($this->defaultConnectionParams[$normalizedType]); } /** * Create the connection parameters for the config * * @return array */ public function createConnectionParams() { $type = $this->config->getValue('dbtype', 'sqlite'); $connectionParams = [ 'user' => $this->config->getValue('dbuser', ''), 'password' => $this->config->getValue('dbpassword', ''), ]; $name = $this->config->getValue('dbname', 'owncloud'); if ($this->normalizeType($type) === 'sqlite3') { $dataDir = $this->config->getValue("datadirectory", \OC::$SERVERROOT . '/data'); $connectionParams['path'] = $dataDir . '/' . $name . '.db'; } else { $host = $this->config->getValue('dbhost', ''); if (strpos($host, ':')) { // Host variable may carry a port or socket. list($host, $portOrSocket) = explode(':', $host, 2); if (ctype_digit($portOrSocket)) { $connectionParams['port'] = $portOrSocket; } else { $connectionParams['unix_socket'] = $portOrSocket; } } $connectionParams['host'] = $host; $connectionParams['dbname'] = $name; } $connectionParams['tablePrefix'] = $this->config->getValue('dbtableprefix', 'oc_'); $connectionParams['sqlite.journal_mode'] = $this->config->getValue('sqlite.journal_mode', 'WAL'); //additional driver options, eg. for mysql ssl $driverOptions = $this->config->getValue('dbdriveroptions', null); if ($driverOptions) { $connectionParams['driverOptions'] = $driverOptions; } // set default table creation options $connectionParams['defaultTableOptions'] = [ 'collate' => 'utf8_bin', 'tablePrefix' => $connectionParams['tablePrefix'] ]; if($this->config->getValue('mysql.utf8mb4', false)) { $connectionParams['defaultTableOptions'] = [ 'collate' => 'utf8mb4_bin', 'charset' => 'utf8mb4', 'row_format' => 'compressed', 'tablePrefix' => $connectionParams['tablePrefix'] ]; } return $connectionParams; } }