forces a file creation

@return bool
@deprecated Use create() instead
544268
public function forceCreate(): bool {
        if (!$this->isFile()) {
            return \mkdir($this->path, 0744, true);
        }
        if ($this->isFile() && !$this->isWritable()) {
            $user = \get_current_user();
            return \chown($this->path, $user);
        }
        return false;
    }
684283
public function make()
    {
        $ext = strtolower(strrchr($this->path, '.'));
        $path = storage_path('app/public/') . $this->path;
        switch ($ext) {
            case '.jpg':
            case '.jpeg':
                $this->image = @imagecreatefromjpeg($path);
                break;
            case '.gif':
                $this->image = @imagecreatefromgif($path);
                break;
            case '.png':
                $this->image = @imagecreatefrompng($path);
                break;
            default:
                $this->image = false;
                break;
        }

        if (false === $this->image) {
            throw new ImageNotFoundException('Image extension not supported!');
        }
        $this->width = imagesx($this->image);
        $this->height = imagesy($this->image);

        return $this;
    }
377713
public function postCreate()
    {
        //  @todo (Pablo - 2017-12-18) - this should be protected using admin permissions or the token uploader
        $oHttpCodes = Factory::service('HttpCodes');
        $oInput     = Factory::service('Input');
        $oCdn       = Factory::service('Cdn', 'nails/module-cdn');
        $aOut       = [];

        // --------------------------------------------------------------------------

        $sBucket = $oInput->post('bucket') ?: $oInput->header('X-Cdn-Bucket');

        if (!$sBucket) {
            throw new ApiException(
                'Bucket not defined',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        // --------------------------------------------------------------------------

        //  Attempt upload
        $oObject = $oCdn->objectCreate('upload', $sBucket);

        if (!$oObject) {
            throw new ApiException(
                $oCdn->lastError(),
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        //  @todo (Pablo - 2018-06-25) - Reduce the namespace here (i.e remove `object`)
        return Factory::factory('ApiResponse', 'nails/module-api')
            ->setData([
                'object' => $this->formatObject(
                    $oObject,
                    $this->getRequestedUrls()
                ),
            ]);
    }
717840
public function create()
	{
		$db = \App::get('db');

		if (empty($db))
		{
			return false;
		}

		$cn = $this->cn;
		$gidNumber = $this->gidNumber;

		if (empty($cn) && empty($gidNumber))
		{
			return false;
		}

		if (is_numeric($gidNumber))
		{
			if (empty($cn))
			{
				$cn = '_gid' . $gidNumber;
			}

			$query = "INSERT INTO `#__xgroups` (gidNumber,cn) VALUES (" . $db->quote($gidNumber) . "," . $db->quote($cn) . ");";

			$db->setQuery($query);

			$result = $db->query();

			if ($result === false && $db->getErrorNum() != 1062)
			{
				return false;
			}
		}
		else
		{
			$query = "INSERT INTO `#__xgroups` (cn) VALUES (" . $db->quote($cn) . ");";

			$db->setQuery($query);

			$result = $db->query();

			if ($result === false && $db->getErrorNum() == 1062) // row exists
			{
				$query = "SELECT gidNumber FROM `#__xgroups` WHERE cn=" . $db->quote($cn) . ";";

				$db->setQeury($query);

				$result = $db->loadResult();

				if (empty($result))
				{
					return false;
				}

				$this->__set('gidNumber', $result);
			}
			else if ($result !== false)
			{
				$this->__set('gidNumber', $db->insertid());
			}
			else
			{
				return false;
			}
		}

		//trigger the onAfterStoreGroup event
		\Event::trigger('user.onAfterStoreGroup', array($this));

		return $this->gidNumber;
	}
1039197
public function create() {

		if(false === $this -> file -> getExists()) {
			
			fopen($this -> file -> getBasepath(), 'w+');

			$this -> refresh();
		}

		return $this;
	}
1211305
public function forceDownload()
    {


        if ($this->type == "jpg")

    {
            $this->toJpg();

        } elseif ($this->type == "png") {

            $this->toPng();

        } elseif ($this->type == "gif") {

            $this->toGif();
        }

        header('Content-Description: File Transfer');
        header("Content-Type: application/octet-stream");
        header('Content-Length: ' . filesize($this->path));
        header('Content-Disposition: attachment; filename="' . basename($this->path.'"'));
        readfile($this->path);

        //remove the temp file
        unlink($this->path);

    }
952084
public function resolve()
    {
        $originFile = $this->file->getPhysicalFile();

        // force format storage directory
        $this->filesystem->mkdir(
            $relatedDestDir = sprintf('%s/%s',
                dirname($originFile->getRealPath()),
                $this->inflector->slugify($this->format->getId(), '_')
            )
        );

        // format call
        $this->formatter
            ->open($originFile->getRealPath())
            ->crop(
                new Point($this->options->x, $this->options->y),
                new Box($this->options->width, $this->options->height)
            )
            ->save($formattedFileName = sprintf('%s/%s',
                $relatedDestDir,
                $originFile->getBasename()
            ))
        ;

        // File object creation (if required)
        $file = $this->fileDomain->create(new PhysicalFile($formattedFileName));

        $this->formattedImage = $this->formattedImageLoader->retrieveByFile($file)
            ?: new $this->formattedImageClass()
        ;
        $this->formattedImage
            ->setFormat($this->format)
            ->setFile($file)
        ;

        $this->assertEntityIsValid($this->formattedImage, array('FormattedImage', 'creation'));

        $this->fireEvent(
            FormattedImageEvents::FORMATTED_IMAGE_CREATED,
            new FormattedImageEvent($this->formattedImage, $this)
        );

        return $this->formattedImage;
    }
688506
public function forceOpen()
    {
        if (!$this->isOpen()) {
            $this->fireEvent(self::CLOSED, self::OPEN);
        }

        $failTime = time();
        for ($i = 0; $i < $this->threshold; $i ++) {
            $this->failures[] = $failTime;
        }
        return $this->write();
    }
504509
public static function create()
	{
		switch (func_num_args()) {
			case 0:
				return new File();
			case 1:
				return new File(func_get_arg(0));
			case 2:
				return new File(func_get_arg(0), func_get_arg(1));
			case 3:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2));
			case 4:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3));
			case 5:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4));
			case 6:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5));
			case 7:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6));
			case 8:
				return new File(func_get_arg(0), func_get_arg(1), func_get_arg(2), func_get_arg(3), func_get_arg(4), func_get_arg(5), func_get_arg(6), func_get_arg(7));
			default:
				throw new \InvalidArgumentException('More than 8 arguments supplied, please be reasonable.');
		}
	}
4336
public static function forceDownload($file)
    {
        if (isset($file)&&(file_exists($file))) {
           header("Content-length: ".filesize($file));  
           header('Content-Type: application/octet-stream');  
           header('Content-Disposition: attachment; filename="' . $file . '"'); 
           readfile($file);
        } else {
            echo "No file selected";
        }
    }
180033
public static function copy($file_path = null, $target_path = null, $force = false, array &$logs = array())
    {
        if (is_null($file_path) || is_null($target_path)) {
            return null;
        }
        if (!file_exists($file_path)) {
            $logs[] = sprintf('File path "%s" to copy was not found.', $file_path);
            return false;
        }
        $target_dir = dirname($target_path);
        $ok = (!file_exists($target_dir) && true===$force) ? Directory::create($target_dir) : true;
        if ($ok) {
            if (!file_exists($target_path) || true===$force) {
                if (copy($file_path, $target_path)) {
                    return true;
                } else {
                    $logs[] = sprintf('Can not copy file "%s" to "%s".', $file_path, $target_path);
                }
            } else {
                $logs[] = sprintf('Can not over-write target file "%s" by copy (use param `$force=true`).', $target_path);
            }
        } else {
            $logs[] = sprintf('Can not create target directory "%s" for copy.', $target_dir);
        }
        return false;
    }
267889
public function create()
    {
        $dir = $this->Folder->pwd();

        if (is_dir($dir) && is_writable($dir) && !$this->exists() && touch($this->path)) {
            return true;
        }

        return false;
    }
428984
public function build(): SetFileInputFilesRequest
	{
		$instance = new SetFileInputFilesRequest();
		if ($this->files === null) {
			throw new BuilderException('Property [files] is required.');
		}
		$instance->files = $this->files;
		$instance->nodeId = $this->nodeId;
		$instance->backendNodeId = $this->backendNodeId;
		$instance->objectId = $this->objectId;
		return $instance;
	}
24720
public function create($last = false)
    {
        if (!file_exists($this->destination)) {
            $dir = dirname($this->destination);
            if (!is_dir($dir)) {
                mkdir($dir, 0755, true);
            }

            if (@file_put_contents($this->destination, $this->generateFileContents()) > 0) {
                $this->command->output->writeLn($this->command->tree($last) . $this->command->ok($this->destination));
            } else {
                $this->command->output->writeLn($this->command->tree($last) . $this->command->fail($this->destination));
            }

        } else {
            $this->command->output->writeLn($this->command->tree($last) . $this->command->skip($this->destination));
        }
    }
439314
public function createTarFileSet()
    {
        $this->fileset = new TarFileSet();
        $this->filesets[] = $this->fileset;

        return $this->fileset;
    }
329516
public function createFile()
    {
        $cacheDependencyFileName = $this->getDependencyFileName();
        if ( ! file_exists(dirname($cacheDependencyFileName)) ) {
            FileHelper::createDirectory(dirname($cacheDependencyFileName));
        }
        file_put_contents($cacheDependencyFileName, uniqid());
        return $cacheDependencyFileName;
    }
1236470
public function save($force = false) {
        if (!$this->writeable) {
            return false;
        }

        if (!$this->dirty && !$force) {
            return null;
        }

        $savetype = $force ? 'forced ' : '';
        if (is_null($force)) {
            $savetype = 'auto ';
        }

        $path = dirname($this->file);
        if (!is_dir($path)) {
            mkdir($path, 0755, true);
        }

        $data = $this->store->dump();
        $conf = version_compare(PHP_VERSION, '5.4', '>=') ? json_encode($data, JSON_PRETTY_PRINT) : json_encode($data);
        unset($data);
        if (!$conf || !json_decode($conf)) {
            return;
        }
        $saved = (bool)$this->writeAtomic($this->file, $conf, 0755);

        if ($saved) {
            $this->dirty = false;
        }

        return $saved;
    }