Editing files in a whole directory using PHP executing from one file.

Discussion in 'PHP' started by ultimatenet, Jun 9, 2012.

  1. #1
    Hello, new to DP.

    Would it be possible to edit multiple .php files in a directory when one "update.php" file is run.
    Where it selects certain parts of the php code from other files and updates/removes or adds to it - done for multiple files.


    If it is possible can anyone provide a basic example of it being executed?

    Thanks for reading,

    Sincerely, Tim.
     
    ultimatenet, Jun 9, 2012 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    You are trying to update files or what? please give us more info (for patching software?)
     
    EricBruggema, Jun 15, 2012 IP
  3. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #3
    Is it possible? Sure. Open the first file to be edited, make the edits, write the file back. Move on to the second file. Wash, rinse, repeat.

    Of course you'd have to rewrite the update file each time you wanted to do an update. That's why the concept of CMS was invented. It's much easier to modify a database than it is to modify PHP files.
     
    Rukbat, Jun 15, 2012 IP