Jump to content

FileStorage move causes storage folder to chmod to 666

Jon Erickson

Recommended Posts

I am working on implementing the FileStorage extension and when I create a custom storage location and then set the FileStorage to the new storage location to trigger a move, the files are moved but the folder chmods to 666 and is unaccessible unless I re-chmod it to 755. Then when I set the storage location back to the default uploads path, it actually chmods the native uploads folder to 666. I cant figure out for the life of me why this is happening.

public function move( $offset, $storageConfiguration, $oldConfiguration=NULL )
    // Keep a record of the file before its moved
    $record = \IPS\Db::i()->select( '*', \IPS\perscom\Units\CombatUnit::$databaseTable, array(), 'combat_units_id', array( $offset, 1 ) )->first();

    // Try and get the file
        // Get the file and move it
        $file = \IPS\File::get( $oldConfiguration ?: 'perscom_CombatUnit', $record['combat_units_image'] )->move( $storageConfiguration );

        // If we successfully moved it and the record location is now something other than the original
        if ( (string) $file != $record['combat_units_image'] )
            // Update the db entry with the new record location
            \IPS\Db::i()->update( \IPS\perscom\Units\CombatUnit::$databaseTable, array( 'combat_units_image' => (string) $file ), array( 'combat_units_id=?', $record['combat_units_id'] ) );

    // Unable to move or set new record location
    catch( \Exception $e ) {}


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...