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 399
Zeile 193... Zeile 193...
193
    /**
193
    /**
194
     * Write the contents of a file, replacing it atomically if it already exists.
194
     * Write the contents of a file, replacing it atomically if it already exists.
195
     *
195
     *
196
     * @param  string  $path
196
     * @param  string  $path
197
     * @param  string  $content
197
     * @param  string  $content
-
 
198
     * @param  int|null  $mode
198
     * @return void
199
     * @return void
199
     */
200
     */
200
    public function replace($path, $content)
201
    public function replace($path, $content, $mode = null)
201
    {
202
    {
202
        // If the path already exists and is a symlink, get the real path...
203
        // If the path already exists and is a symlink, get the real path...
203
        clearstatcache(true, $path);
204
        clearstatcache(true, $path);
Zeile 204... Zeile 205...
204
 
205
 
Zeile 205... Zeile 206...
205
        $path = realpath($path) ?: $path;
206
        $path = realpath($path) ?: $path;
Zeile 206... Zeile 207...
206
 
207
 
-
 
208
        $tempPath = tempnam(dirname($path), basename($path));
-
 
209
 
-
 
210
        // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600...
207
        $tempPath = tempnam(dirname($path), basename($path));
211
        if (! is_null($mode)) {
-
 
212
            chmod($tempPath, $mode);
Zeile 208... Zeile 213...
208
 
213
        } else {
Zeile 209... Zeile 214...
209
        // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600...
214
            chmod($tempPath, 0777 - umask());
210
        chmod($tempPath, 0777 - umask());
215
        }