[SOLVED] No idea on how to get a file

Discussion in 'Off-Topic' started by InspectorGadget, Jun 10, 2017.

  1. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    PHP:
    <?php

    /* 
     * Copyright (C) 2017 RTG
     *
     * This program is free software: you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation, either version 3 of the License, or
     * (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     */

    namespace RTG\APIUpdater;

    use 
    pocketmine\plugin\PluginBase;

    class 
    Loader extends PluginBase {
       
        public function 
    onEnable () {
           
            echo 
    getcwd();
            
    chdir("plugins");
            
    $final getcwd();
           
            if (
    $dh opendir($final)) {
               
                
    $file scandir($final);
               
                if (
    in_array("DevTools"$file)) {
                   
                    
    $currentdir getcwd();
                    
    chdir("DevTools");
                   
                    
    $fin getcwd();
                   
                    
    $filee scandir($fin);
                   
                    echo 
    readfile("plugin.yml");
                   
                    
    $check[] = file("plugin.yml");
                   
                    unset (
    $check['api']);
                   
                    foreach (
    $check as $data) {
                   
                        
    file_put_contents("plugin.yml"$data);
                   
                    }            }
               
            }
             
        }
           
    }
    I need help with loading changing the API number here and I know for a fact that changing the number doesn't work always as I'd need to update the lines. I think this could be used a learning plugin for me and also update API for minor changes in the main PMMP repository.

    Please help.

    I want to load plugin.yml as an array and then change it by unsetting it and setting is back but I've no idea.

    Thanks
     
  2. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
  3. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
  4. EdwardHamHam

    EdwardHamHam Skeleton

    Messages:
    962
    GitHub:
    edwardhamham
    Maybe try posting this in the Development section?
     
  5. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    I honestly feel this like something out of that section. If any staff willing to move, it'd be appreciated.
     
  6. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    am not that talented in php but i suppose you can use fopen then fclose
     
  7. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    I've fixed this btw..
     
  8. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    is their no Solved tag?
     
  9. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    idk how to add it, i've renamed this topic.
     
  10. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    ok ^*^
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.