Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 200
Zeile 1... Zeile 1...
1
<?php
1
<?php
Zeile 2... Zeile 2...
2
 
2
 
3
/*
3
/*
4
 * This file is part of Psy Shell.
4
 * This file is part of Psy Shell.
5
 *
5
 *
6
 * (c) 2012-2022 Justin Hileman
6
 * (c) 2012-2023 Justin Hileman
7
 *
7
 *
8
 * For the full copyright and license information, please view the LICENSE
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
9
 * file that was distributed with this source code.
Zeile 31... Zeile 31...
31
        $this->installLocation = \Phar::running(false);
31
        $this->installLocation = \Phar::running(false);
32
    }
32
    }
Zeile 33... Zeile 33...
33
 
33
 
34
    /**
34
    /**
35
     * Public to allow the Downloader to use the temporary directory if it's been set.
-
 
36
     *
-
 
37
     * @return string
35
     * Public to allow the Downloader to use the temporary directory if it's been set.
38
     */
36
     */
39
    public function getTempDirectory(): string
37
    public function getTempDirectory(): string
40
    {
38
    {
41
        return $this->tempDirectory;
39
        return $this->tempDirectory;
Zeile 42... Zeile 40...
42
    }
40
    }
43
 
41
 
44
    /**
-
 
45
     * Verify the currently installed PsySH phar is writable so it can be replaced.
-
 
46
     *
42
    /**
47
     * @return bool
43
     * Verify the currently installed PsySH phar is writable so it can be replaced.
48
     */
44
     */
49
    public function isInstallLocationWritable(): bool
45
    public function isInstallLocationWritable(): bool
50
    {
46
    {
Zeile 51... Zeile 47...
51
        return \is_writable($this->installLocation);
47
        return \is_writable($this->installLocation);
52
    }
48
    }
53
 
-
 
54
    /**
-
 
55
     * Verify the temporary directory is writable so downloads and backups can be saved there.
49
 
56
     *
50
    /**
57
     * @return bool
51
     * Verify the temporary directory is writable so downloads and backups can be saved there.
58
     */
52
     */
59
    public function isTempDirectoryWritable(): bool
53
    public function isTempDirectoryWritable(): bool
Zeile 60... Zeile 54...
60
    {
54
    {
61
        return \is_writable($this->tempDirectory);
55
        return \is_writable($this->tempDirectory);
62
    }
56
    }
63
 
57
 
64
    /**
-
 
65
     * Verifies the downloaded archive can be extracted with \PharData.
-
 
66
     *
58
    /**
67
     * @param string $sourceArchive
59
     * Verifies the downloaded archive can be extracted with \PharData.
68
     *
60
     *
69
     * @return bool
61
     * @param string $sourceArchive
70
     */
62
     */
Zeile 80... Zeile 72...
80
 
72
 
81
    /**
73
    /**
82
     * Extract the "psysh" phar from the archive and move it, replacing the currently installed phar.
74
     * Extract the "psysh" phar from the archive and move it, replacing the currently installed phar.
83
     *
75
     *
84
     * @param string $sourceArchive
-
 
85
     *
-
 
86
     * @return bool
76
     * @param string $sourceArchive
87
     */
77
     */
88
    public function install(string $sourceArchive): bool
78
    public function install(string $sourceArchive): bool
89
    {
79
    {
90
        $pharArchive = new \PharData($sourceArchive);
80
        $pharArchive = new \PharData($sourceArchive);
Zeile 107... Zeile 97...
107
 
97
 
108
    /**
98
    /**
109
     * Create a backup of the currently installed PsySH phar in the temporary directory with a version number postfix.
99
     * Create a backup of the currently installed PsySH phar in the temporary directory with a version number postfix.
110
     *
100
     *
111
     * @param string $version
-
 
112
     *
-
 
113
     * @return bool
101
     * @param string $version
114
     */
102
     */
115
    public function createBackup(string $version): bool
103
    public function createBackup(string $version): bool
116
    {
104
    {
Zeile 127... Zeile 115...
127
     * Restore the backup file to the original PsySH install location.
115
     * Restore the backup file to the original PsySH install location.
128
     *
116
     *
129
     * @param string $version
117
     * @param string $version
130
     *
118
     *
131
     * @throws ErrorException If the backup file could not be found
119
     * @throws ErrorException If the backup file could not be found
132
     *
-
 
133
     * @return bool
-
 
134
     */
120
     */
135
    public function restoreFromBackup(string $version): bool
121
    public function restoreFromBackup(string $version): bool
136
    {
122
    {
137
        $backupFilename = $this->getBackupFilename($version);
123
        $backupFilename = $this->getBackupFilename($version);
Zeile 145... Zeile 131...
145
 
131
 
146
    /**
132
    /**
147
     * Get the full path for the backup target file location.
133
     * Get the full path for the backup target file location.
148
     *
134
     *
149
     * @param string $version
-
 
150
     *
-
 
151
     * @return string
135
     * @param string $version
152
     */
136
     */
153
    public function getBackupFilename(string $version): string
137
    public function getBackupFilename(string $version): string
154
    {
138
    {