Example #1
0
 public function setUp()
 {
     parent::setUp();
     /* Load our plugin functions */
     GFPDF_InstallUpdater::check_filesystem_api();
     GFPDF_InstallUpdater::maybe_deploy();
 }
 public static function maybe_deploy()
 {
     global $gfpdfe_data;
     /*
      * Check if we have a 'direct' method, that the software isn't fully installed and we aren't trying to manually initialise
      */
     if ($gfpdfe_data->automated === true && $gfpdfe_data->is_initialised === false && !rgpost('upgrade') && get_option('gfpdfe_automated_install') != 'installing') {
         /*
          * Initialise all multisites if a super admin is logged in
          */
         if (is_multisite() && is_super_admin()) {
             $results = GFPDF_InstallUpdater::run_multisite_deployment(array('GFPDF_InstallUpdater', 'do_deploy'));
             if ($results === true) {
                 add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_network_deploy_success'));
             } elseif ($results === false) {
                 add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_auto_deploy_network_failure'));
             }
             return $results;
         } else {
             if (self::do_deploy()) {
                 /*
                  * Output successfull automated installation message
                  */
                 add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_auto_deploy_success'));
             }
         }
     }
 }
Example #3
0
 public function setUp()
 {
     parent::setUp();
     /* Load our plugin functions */
     GFPDF_InstallUpdater::check_filesystem_api();
     GFPDF_InstallUpdater::maybe_deploy();
     /*
      * Admin init was restricted to Gravity Form-only pages 
      */
     global $gfpdf;
     $gfpdf = new GFPDF_Core();
 }
 public function setUp()
 {
     parent::setUp();
     GFPDF_InstallUpdater::check_filesystem_api();
     GFPDF_InstallUpdater::maybe_deploy();
     global $gfpdf;
     $gfpdf = new GFPDF_Core();
     $gfpdf->configuration = array(array('form_id' => 1, 'template' => 'example-template.php', 'filename' => 'testform.pdf'), array('form_id' => 1, 'template' => 'example-template-2.php', 'filename' => 'seconddoc.pdf'), array('form_id' => 2, 'template' => 'default-template.php', 'filename' => 'third-pdf.pdf'), array('form_id' => 2, 'template' => 'default-template.php', 'filename' => 'fourth-pdf.pdf'), array('form_id' => 2, 'template' => 'default-template.php', 'filename' => 'fifth-pdf.pdf'), array('form_id' => 4, 'template' => 'my-custom-template.php', 'security' => true, 'pdf_master_password' => 'admin password'), array('form_id' => 5, 'template' => 'default-template-no-style.php', 'default-show-html' => true, 'default-show-empty' => false, 'default-show-page-names' => true), array('form_id' => 6, 'template' => 'default-template-no-style.php', 'default-show-html' => true, 'default-show-empty' => true, 'default-show-page-names' => true, 'default-show-section-content' => true), array('form_id' => array(7, 8, 9, 10), 'template' => 'default-template-no-style.php', 'default-show-html' => true, 'default-show-empty' => true, 'default-show-page-names' => true, 'default-show-section-content' => true));
     /* reenable the configuration */
     $gfpdf->disabled = false;
     /* reset the index */
     $gfpdf->index = array();
     /* init config index */
     $this->set_form_pdfs();
 }
 public function setUp()
 {
     /*
      * Replace set up with cut down version 
      * so we don't use 'temporary' tables in MySQL
      */
     $this->cut_down_setup();
     /* initialise GF tables */
     GFForms::setup(true);
     /* Load our plugin functions */
     GFPDF_InstallUpdater::check_filesystem_api();
     GFPDF_InstallUpdater::maybe_deploy();
     /* create GF data */
     $this->create_form_and_entries();
     $this->setupConfiguration();
 }
 public function setUp()
 {
     /*
      * For some reasons this wasn't automatically set up so
      * we are running it here.
      */
     $this->factory = new WP_UnitTest_Factory();
     /*
      * Replace set up with cut down version
      * so we don't use 'temporary' tables in MySQL
      */
     $this->cut_down_setup();
     /* initialise GF tables */
     GFForms::setup(true);
     /* Load our plugin functions */
     GFPDF_InstallUpdater::check_filesystem_api();
     GFPDF_InstallUpdater::maybe_deploy();
     /* create GF data */
     $this->create_form_and_entries();
 }
 /**
  * Create test for the GFPDF_InstallUpdater::pdf_extended_copy_directory() function
  * @group install-update
  */
 public function test_move_folder_system()
 {
     $this->setup_move_folder_test();
     /*
      * Setup and run our moving folder function 
      */
     $move_to = ABSPATH . 'tmp2/';
     GFPDF_InstallUpdater::pdf_extended_copy_directory($this->tmp, $move_to);
     /*
      * Run our first test
      */
     $this->verify_folder_structure($move_to);
     /*
      * Override the existing folder and test for newly added file 
      */
     touch($this->tmp . 'extrafile');
     GFPDF_InstallUpdater::pdf_extended_copy_directory($this->tmp, $move_to, true, true);
     /* Run our second test batch */
     $this->verify_folder_structure($move_to);
     $this->assertTrue(is_file($move_to . 'extrafile'));
     unlink($move_to . 'extrafile');
     unlink($this->tmp . 'extrafile');
     /*
      * Delete the source directory when doing the move 
      */
     GFPDF_InstallUpdater::pdf_extended_copy_directory($this->tmp, $move_to, true, true, true);
     $this->verify_folder_structure($move_to);
     $this->assertFalse(is_dir($this->tmp));
     $this->setup_move_folder_test();
     /*
      * Create permissions problems that prevent the files being moved 
      */
     $move_to = '/tmp2';
     $this->assertFalse(GFPDF_InstallUpdater::pdf_extended_copy_directory($this->tmp, $move_to));
 }
Example #8
0
 public static function fully_loaded_admin()
 {
     /*
      * Check user has the correct permissions to deploy the software 
      */
     if (!current_user_can('manage_options')) {
         return;
     }
     global $gfpdfe_data;
     /*
      * Don't run initialiser if we cannot...
      */
     if ($gfpdfe_data->allow_initilisation === false) {
         /*
          * Prompt user about a server configuration problem
          */
         add_action($gfpdfe_data->notice_type, array("GFPDF_Notices", "gf_pdf_server_problem_detected"));
         return false;
     }
     /*
      * Check if we have direct write access to the server 
      */
     GFPDF_InstallUpdater::check_filesystem_api();
     /*
      * Check if we can automatically deploy the software. 
      * 90% of sites should be able to do this as they will have 'direct' write abilities 
      * to their server files.
      */
     GFPDF_InstallUpdater::maybe_deploy();
     /*
      * Check if we need to deploy the software
      */
     self::check_deployment();
     /*
      * Check if the template folder location needs to be migrated
      */
     if (!rgpost('upgrade')) {
         GFPDF_InstallUpdater::check_template_migration();
     }
 }
 private function deploy()
 {
     global $gfpdfe_data;
     /*
      * Initialise all multisites if a super admin is logged in and the software hasn't been installed before
      */
     if (is_multisite() && is_super_admin() && $gfpdfe_data->fresh_install === true) {
         $results = GFPDF_InstallUpdater::run_multisite_deployment(array('GFPDF_InstallUpdater', 'do_deploy'));
         if ($results === true) {
             add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_network_deploy_success'));
         } elseif ($results === false) {
             add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_auto_deploy_network_failure'));
         }
         return $results;
     } else {
         /*
          * Run the updater
          */
         $results = GFPDF_InstallUpdater::pdf_extended_activate();
         if ($results === 'false') {
             return $results;
         }
         add_action($gfpdfe_data->notice_type, array('GFPDF_Notices', 'gf_pdf_deploy_success'));
     }
 }