Proyectos de Subversion LeadersLinked - Services

Rev

Rev 823 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 823 Rev 824
Línea 134... Línea 134...
134
    {
134
    {
135
        $this->config = $config;
135
        $this->config = $config;
136
        $this->adapter = $adapter;
136
        $this->adapter = $adapter;
137
        $this->currentFile = [];
137
        $this->currentFile = [];
Línea 138... Línea -...
138
 
-
 
139
        // Cargar configuración desde storage.ini
-
 
140
        $this->loadStorageConfig();
-
 
141
 
138
 
142
        // Ruta relativa para BD
139
        // Ruta relativa para BD
Línea 143... Línea 140...
143
        $this->storagePath = str_replace('\\', '/', $this->storageConfig['base_path']);
140
        $this->storagePath = 'data' . DIRECTORY_SEPARATOR . 'storage';
144
        
141
        
Línea 145... Línea 142...
145
        // Ruta completa para operaciones de archivo
142
        // Ruta completa para operaciones de archivo
146
        $this->fullStoragePath = str_replace('\\', '/', $this->storageConfig['full_path']);
143
        $this->fullStoragePath = $this->config['leaderslinked.storage.path'] . DIRECTORY_SEPARATOR . $this->storagePath;
147
 
144
 
Línea 148... Línea 145...
148
        if (!file_exists($this->fullStoragePath)) {
145
        if (!file_exists($this->fullStoragePath)) {
Línea 149... Línea 146...
149
            mkdir($this->fullStoragePath, 0775, true);
146
            mkdir($this->fullStoragePath, 0775, true);
150
        }
147
        }
151
 
148
 
152
        $this->tempPath = str_replace('\\', '/', $this->storageConfig['temp_path']);
149
        $this->tempPath = $this->storagePath . DIRECTORY_SEPARATOR . 'tmp';
Línea 260... Línea 257...
260
    {
257
    {
261
        return $this->fullStoragePath . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . 'company-footer.png';
258
        return $this->fullStoragePath . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . 'company-footer.png';
262
    }
259
    }
Línea 263... Línea 260...
263
 
260
 
264
    /**
-
 
265
     * Carga la configuración desde el archivo storage.ini
-
 
266
     */
-
 
267
    private function loadStorageConfig()
-
 
268
    {
-
 
269
        $iniPath = 'config' . DIRECTORY_SEPARATOR . 'storage.ini';
-
 
270
        if (file_exists($iniPath)) {
-
 
271
            $ini = parse_ini_file($iniPath, true);
-
 
272
            $this->storageConfig = [
-
 
273
                'base_path' => $ini['storage']['base_path'] ?? 'data/storage',
-
 
274
                'full_path' => $ini['storage']['full_path'] ?? 'data/storage',
-
 
275
                'base_url' => $ini['storage']['base_url'] ?? '',
-
 
276
                'temp_path' => $ini['temp']['temp_path'] ?? 'data/storage/tmp'
-
 
277
            ];
-
 
278
        } else {
-
 
279
            // Configuración por defecto si no existe el archivo .ini
-
 
280
            $this->storageConfig = [
-
 
281
                'base_path' => 'data/storage',
-
 
282
                'full_path' => 'data/storage',
-
 
283
                'base_url' => '',
-
 
284
                'temp_path' => 'data/storage/tmp'
-
 
285
            ];
-
 
286
        }
-
 
287
    }
-
 
288
 
-
 
289
    /**
261
    /**
290
     * Convierte una ruta relativa a ruta completa para operaciones de archivo
262
     * Convierte una ruta relativa a ruta completa para operaciones de archivo
291
     * @param string $relativePath
263
     * @param string $relativePath
292
     * @return string
264
     * @return string
293
     */
265
     */