Creates DBF file.

@return bool
12584
private function _createDBFFile()
    {
        if (! self::supportsDbase() || ! is_array($this->DBFHeader) || count($this->DBFHeader) == 0) {
            $this->DBFFile = null;

            return true;
        }
        $dbf_name = $this->_getFilename('.dbf');

        /* Unlink existing file */
        if (file_exists($dbf_name)) {
            unlink($dbf_name);
        }

        /* Create new file */
        $this->DBFFile = @dbase_create($dbf_name, $this->DBFHeader);
        if ($this->DBFFile === false) {
            $this->setError(sprintf('It wasn\'t possible to create the DBase file "%s"', $dbf_name));

            return false;
        }

        return true;
    }
718173
public function create ($exclude = array (), &$db = FALSE)
	{
		
		// Get columns and values
		
		$create	= $this->createColumnsAndValues ($exclude);
		
		// Get database master for write
		
		if ($db === FALSE)
		{
			$db	=& $this->getDbMaster ();
		}
		
		// Prepare query
		
		$query	= $db->prepare ('
		INSERT INTO `' . static::$dbTable . '` (' . $create['columns'] . ')
		VALUES ( ' . $create['values'] . ')
		');
		
		// Bind attributes
		
		$this->bindAttributes ($query, $exclude);
		
		// Execute
		
		if (!$this->executeCreateUpdateQuery ($query))
		{
			return FALSE;
		}
		
		// Set the pk

		if (!$this->attributeHasValue (static::$pk) || !$this->iget (static::$pk))
		{
			$this->iset (static::$pk, $db->lastInsertID ());
		}
		
		// Changelog
		
		if ($this->changelog ('create'))
		{
			$log =& $this->getResource ('changelog');
			$log->hookTransactions ($db);
			$log::_Log ('create', static::_Read ($this->iget (static::$pk), $db));
		}

		// return TRUE

		return TRUE;
		
	}
119096
protected function _createLockFile()
    {
        is_true_or_fail(!$this->getConfig('lockFile') || !file_exists($this->lockFile), __d(
            'link-scanner',
            'Lock file `{0}` already exists, maybe a scan is already in progress. If not, remove it manually',
            $this->lockFile
        ), RuntimeException::class);

        return $this->getConfig('lockFile') ? new File($this->lockFile, true) !== false : true;
    }
223367
public function create()
    {
        $this->sql = new PhiberQueryWriter("create", [
            "table"  => $this->table,
            "fields" => $this->fields,
            "values" => $this->fieldsValues
        ]);

        if ($this->phiberConfig->verifyExecuteQueries()) {
            $stmt = $this->PDO->prepare($this->sql);

            for ($i = 0; $i < count($this->fields); $i++) {
                if ($this->fieldsValues[$i] != null) {
                    $stmt->bindValue($this->fields[$i], $this->fieldsValues[$i]);
                }
            }
            if ($stmt->execute()) {
                return $this->PDO->lastInsertId();
            }
        }

        return false;
    }
439314
public function createTarFileSet()
    {
        $this->fileset = new TarFileSet();
        $this->filesets[] = $this->fileset;

        return $this->fileset;
    }
934140
protected function createBaseInterfaceFile()
    {
        if( ! $this->files->exists($this->getRepositoryDirectory() . 'BaseRepositoryInterface.php')) {
            $stub = str_replace(
                ['{{Namespace}}'],
                $this->getRepositoryDirectoryFromConfig(),
                $this->files->get(__DIR__ . '/../stubs/base-interface.stub')
            );

            $this->files->put(base_path() . '/' . $this->getRepositoryDirectory() . 'BaseRepositoryInterface.php', $stub);
        }
    }
277357
private function createFormFiles() {
        $db = \Cityware\Db\Factory::factory('zend');
        $tableMetadata = new \Zend\Db\Metadata\Metadata($db->getAdapter());
        $tableInfo = $tableMetadata->getTable($this->getTable(), $this->getSchema());

        $iniFile = $this->genConfigFormIni();
        $iniFile .= $this->genFieldsFormIni($tableInfo);
        $iniFile .= $this->genButtonsFormIni();

        $translateFile = $this->genTranslateFormArray($tableInfo);

        $moduleName = ucfirst($this->getModule());
        $moduleNameLower = strtolower($this->getModule());

        try {
            if (!empty($this->formName)) {
                file_put_contents($this->dstIniDirectory . $this->formName . '.ini', $iniFile);
                chmod($this->dstIniDirectory . $this->formName . '.ini', 0777);

                file_put_contents($this->dstTranslateDirectory . $this->formName . '.php', $translateFile);
                chmod($this->dstTranslateDirectory . $this->formName . '.php', 0777);

                $template_Form = file_get_contents($this->srcTemplateDirectory . 'Template_Form.tmpl');
                $templateForm = str_replace("%moduleName%", $moduleName, str_replace("%moduleNameLower%", $moduleNameLower, $template_Form));
                file_put_contents($this->dstViewDirectory . $this->formName . '.phtml', $templateForm);
                chmod($this->dstViewDirectory . $this->formName . '.phtml', 0644);
            } else {
                file_put_contents($this->dstIniDirectory . 'add.ini', $iniFile);
                chmod($this->dstIniDirectory . 'add.ini', 0777);

                file_put_contents($this->dstTranslateDirectory . 'add.php', $translateFile);
                chmod($this->dstTranslateDirectory . 'add.php', 0777);

                file_put_contents($this->dstIniDirectory . 'edit.ini', $iniFile);
                chmod($this->dstIniDirectory . 'edit.ini', 0777);

                file_put_contents($this->dstTranslateDirectory . 'edit.php', $translateFile);
                chmod($this->dstTranslateDirectory . 'edit.php', 0777);

                $template_Form = file_get_contents($this->srcTemplateDirectory . 'Template_Form.tmpl');
                $templateForm = str_replace("%moduleName%", $moduleName, str_replace("%moduleNameLower%", $moduleNameLower, $template_Form));

                file_put_contents($this->dstViewDirectory . 'add.phtml', $templateForm);
                chmod($this->dstViewDirectory . 'add.phtml', 0644);

                file_put_contents($this->dstViewDirectory . 'edit.phtml', $templateForm);
                chmod($this->dstViewDirectory . 'edit.phtml', 0644);
            }
        } catch (Exception $exc) {
            throw new Exception('Não foi possivel criar o arquivo de configuração do formulário! <br />' . $exc->getMessage(), 500);
        }
    }
83690
protected function createSqliteDatabase()
    {
        $dbPath = config('database.connections.sqlite.database');
        $createDb = new Process("touch $dbPath");
        $createDb->run();

        if (! $createDb->isSuccessful()) {
            $this->warn("I couldn't create your SQLite database file.");
            $this->warn("Please create it after setup is complete and re-run setup.");
            $this->warn("Run `touch database/database.sqlite`");
            Storage::put('installer', '1');
            logger('NETWORK.INSTALL: Failed to create SQLite database');
            $this->hasError = true;

            return false;
        }

        $this->info("Database created at $dbPath.");

        return true;
    }
1114045
public function createAction()
    {
        $form = $this->createForm();
        $submit = new Submit();
        $lng = \Cmf\Language\Factory::get($this);
        $submit->setValue($lng['create']);
        $form->setElement($submit);

        $response = [
            'form' => $form,
            'actionLinks' => ActionLinkFactory::createLinks($this->getActionLinkConfig()),
        ];

        if ($form->isSubmitted()) {
            $form->getValuesFromRequest();
            if ($form->validate()) {
                $entity = new $this->entityName();
                $this->fillEntityFromForm($entity, $form);
                $this->fillEntityForCreate($entity);

                try {
                    $em = $this->getEntityManager();
                    $em->persist($entity);
                    $em->flush();
                    $result = true;
                } catch (\Exception $e) {
                    $lng = \Cmf\Language\Factory::get($this);
                    $form->getMessages()->setItem(new Message($lng[self::ERR_DB]));
                    $result = false;
                }
                if ($result) {
                    $response = new PostRedirectGet($this);
                    $response->setRedirectPath([
                        'module' => $this->request->getModuleName(),
                        'controller' => $this->getControllerName(),
                        'action' => 'creationOk',
                    ]);
                }
            }
        }

        return $response;
    }
1371942
public static function factory(array $dbConfig): DbItf
    {
        /** @var DbItf[] $instances */
        static $instances = [];

        $key = md5(json_encode($dbConfig));

        if (isset($instances[$key])) {
            return $instances[$key];
        }

        switch ($dbConfig[DbItf::DB_CFG_DRIVER]) {
            case DbItf::DB_DRIVER_MYSQL:
                $instances[$key] = new MySQL();
                $dbConfig[DbItf::DB_CFG_PORT] = (int)$dbConfig[DbItf::DB_CFG_PORT];
                break;

            default:
                throw new DatabaseEx('Unknown database driver name: ' . $dbConfig[DbItf::DB_CFG_DRIVER]);
        }

        $instances[$key]->dbSetup($dbConfig);

        if ($dbConfig[DbItf::DB_CFG_CONNECT]) {
            $instances[$key]->dbConnect();
        }

        return $instances[$key];
    }
1199176
public function create()
    {
        $type = NodeType::getByHandle('file');
        if (!is_object($type)) {
            NodeType::add('file');
        }
        $type = NodeType::getByHandle('file_folder');
        if (!is_object($type)) {
            NodeType::add('file_folder');
        }
        $type = NodeType::getByHandle('search_preset');
        if (!is_object($type)) {
            NodeType::add('search_preset');
        }
        $type = TreeType::getByHandle('file_manager');
        if (!is_object($type)) {
            TreeType::add('file_manager');
        }

        $manager = FileManager::get();
        if (!is_object($manager)) {
            $manager = FileManager::add();
        }

        return $manager;
    }
70092
public function createDatabase($dbName = null)
    {
        if (is_null($dbName)) {
            $dbName = $this->getDbName();
        }

        $dbName = str_replace('`', '', $dbName);

        Db::exec("CREATE DATABASE IF NOT EXISTS `" . $dbName . "` DEFAULT CHARACTER SET utf8");
    }
329516
public function createFile()
    {
        $cacheDependencyFileName = $this->getDependencyFileName();
        if ( ! file_exists(dirname($cacheDependencyFileName)) ) {
            FileHelper::createDirectory(dirname($cacheDependencyFileName));
        }
        file_put_contents($cacheDependencyFileName, uniqid());
        return $cacheDependencyFileName;
    }
719537
public function restoreDb()
    {
        $database = new Database($this->connection);

        try {
            $this->log('debug', sprintf('Restore database with file : %s', $this->backupFile));

            if (!file_exists($this->backupFile)) {
                return false;
            }

            $database->restoreDb($this->backupFile);
        } catch (\Exception $ex) {
            $this->log('error', sprintf('error during restore process with message : %s', $ex->getMessage()));
            print $ex->getMessage();
            return false;
        }

        return true;
    }
636381
public function create()
    {
        $installedLogFile = storage_path('installed');

        $dateStamp = date("Y/m/d h:i:sa");

        if (!file_exists($installedLogFile))
        {
            $message = trans('installer_messages.installed.success_log_message') . $dateStamp . "\n";

            file_put_contents($installedLogFile, $message);

        } else {
            $message = trans('installer_messages.updater.log.success_message') . $dateStamp;

            file_put_contents($installedLogFile, $message.PHP_EOL , FILE_APPEND | LOCK_EX);
        }

        return $message;
    }
107900
public function create()
    {
        $config = $this->getDbConfig();

        $db = new MySQL();
        if (!$db->connect($config)) {
            throw new \RuntimeException('connect to database server failure. info=' . \json_encode($config));
        }

        // add metadata
        $id               = $this->genID($db);
        $time             = \time();
        $this->metas[$id] = [
            'createAt' => $time,
            'activeAt' => $time,
            'config'   => $config, // record for reconnection.
        ];

        return $db;
    }
1311659
protected function createDatabase()
    {
        $database = array_get($this->config, 'database', false);

        // check if file exists first
        if (! $database || ! file_exists($database)) {
            throw new InvalidCredentialsException();
        }

        // catch maxmind exception and throw geoip exception
        try {
            return new Reader($database);
        } catch (\MaxMind\Db\Reader\InvalidDatabaseException $e) {
            throw new InvalidDatabaseException($e->getMessage(), $e->getCode(), $e);
        }
    }