Proyectos de Subversion LeadersLinked - Services

Rev

Rev 770 | Rev 808 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 770 Rev 807
Línea 123... Línea 123...
123
            }
123
            }
Línea 124... Línea 124...
124
            
124
            
125
            $storageFileMapper = \LeadersLinked\Mapper\StorageFileMapper::getInstance($this->adapter);
125
            $storageFileMapper = \LeadersLinked\Mapper\StorageFileMapper::getInstance($this->adapter);
Línea 126... Línea -...
126
            $storageFile = $storageFileMapper->fetchOneByCode($code);
-
 
-
 
126
            $storageFile = $storageFileMapper->fetchOneByCode($code);
-
 
127
            
Línea 127... Línea 128...
127
            
128
            $storageDir = $this->config['leaderslinked.storage.path'];
Línea 128... Línea 129...
128
           
129
            $storageFileFullPath = $storageDir . DIRECTORY_SEPARATOR . $storageFile->path;
Línea 129... Línea 130...
129
            
130
            
130
            if($storageFile) {
131
            if($storageFileFullPath) {
131
               
132
               
132
                
133
                
133
                if(file_exists($storageFile->path)) {
134
                if(file_exists($storageFileFullPath)) {
Línea 134... Línea 135...
134
                    
135
                    
135
                    // Check if the path is a directory instead of a file
136
                    // Check if the path is a directory instead of a file
136
                    if(is_dir($storageFile->path)) {
137
                    if(is_dir($storageFileFullPath)) {
137
                        $this->logger->err('StorageFile path is a directory instead of a file: ' . $storageFile->path . ' (code: ' . $code . ')');
138
                        $this->logger->err('StorageFile path is a directory instead of a file: ' . $storageFile->path . ' (code: ' . $code . ')');
Línea 138... Línea 139...
138
                        return $this->getResponse()->setStatusCode(500);
139
                        return $this->getResponse()->setStatusCode(500);
139
                    }
140
                    }
Línea 140... Línea 141...
140
                    
141
                    
141
                    // Try to open file
142
                    // Try to open file
142
                    if (!is_readable($storageFile->path)) {
143
                    if (!is_readable($storageFileFullPath)) {
143
                        return $this->getResponse()->setStatusCode(500);
144
                        return $this->getResponse()->setStatusCode(500);
144
                    }
145
                    }
Línea 145... Línea 146...
145
                    
146
                    
Línea 146... Línea 147...
146
                    // Get file size in bytes.
147
                    // Get file size in bytes.
147
                    $fileSize = filesize($storageFile->path);
148
                    $fileSize = filesize($storageFileFullPath);
148
                    
149
                    
149
                    // Get MIME type of the file.
150
                    // Get MIME type of the file.