• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Many duplicate files and folders while restoring archive of web app CI 2

#1
Pages will not render when trying to restore Codeigniter app from proven tar.gz. 
When the app was in live environment I was able to make and see edits made to files
following the path: /public_html/x/application/views/y.php

\public_html\x\index.php identifies SYSTEM FOLDER NAME of
$system_path = 'system'; and APPLICATION FOLDER NAME of
$application_folder = 'application';
I've assumed the application folder is "application" and system folder is "system"

Their are numerous sets of subfolders with duplicate files and names.

\public_html\index.php identifies SYSTEM FOLDER NAME of
$system_path = 'system/codeigniter'; and APPLICATION FOLDER NAME of
$application_folder = 'system/pyrocms';
 - folders exist in those locations with complete sets of files as do others




there are 110 index.php, 18 config.php, 15 routes.php files identifying different System and Application folders
and default controllers.  About half have the first letter lowercase and other differences
I don't know how to prioritize...

There is a production and test environment.
Reply

#2
I'm afraid that's impossible to say really. As we don't see your code and only you know what's real and what's not.
Depending on the size of the project, just re-write it again instead.

If you don't want to re-write it you can grab the latest CI 2 here, and you will need to match it against a real strucute:
https://codeigniter.com/en/download

PS. I moved the thread into CodeIgniter 2.x as this are considered legacy.
Reply

#3
Thank you for getting right back to me. It is a large project and previously the hosting company was able to restore in less than an hour. I was hoping there was a fundamental rule or two that could correct my current confusion.
Reply

#4
It feels like they restored it multiple times, if you end up with multiple sub-folders containing the same data. They odd part are that the index.php points to different system and/or application folder namnes.

The main one that tries to load right now are /public_html/index.php but if it's the one you want... we can't tell you.
Reply

#5
That sounds good. I will configure the setting to start from there and do my best to follow the routing. Thank you.I was told it was done to generate confusion...
Reply

#6
That just utterly stupid to create an application that include unusable code. A honeypot with multiple files...
Reply

#7
I'm still not able to figure things out. If you get and chance and can look below a the

/public_html/index.php contents I would appreciate it.
PHP Code:
/* APPLICATION ENVIRONMENT
 *---------------------------------------------------------------
 *
 * You can load different configurations depending on your
 * current environment. Setting the environment also influences
 * things like logging and error reporting.
 *
 * This can be set to anything, but default usage is:
 *
 *     development
 *     testing
 *     production
 *
 * NOTE: If you change these, also change the error_reporting() code below
 *
 */

// Local: localhost or local.example.com
if ($_SERVER['SERVER_NAME'])
{
    if (
strpos($_SERVER['SERVER_NAME'], 'local.') !== FALSE OR $_SERVER['SERVER_NAME'] == 'localhost' OR strpos($_SERVER['SERVER_NAME'], '.local') !== FALSE)
    {
        
define('ENVIRONMENT''local');
    }

    
// Development: dev.example.com
    
elseif (strpos($_SERVER['SERVER_NAME'], 'dev.') === 0)
    {
        
define('ENVIRONMENT''dev');
    }

    
// Quality Assurance: qa.example.com
    
elseif (strpos($_SERVER['SERVER_NAME'], 'qa.') === 0)
    {
        
define('ENVIRONMENT''qa');
    }

    
// Live: example.com
    
else
    {
        
define('ENVIRONMENT''live');
    }
}
else
{
    
define('ENVIRONMENT''local');
}

/*
 *---------------------------------------------------------------
 * ERROR REPORTING
 *---------------------------------------------------------------
 *
 * Different environments will require different levels of error reporting.
 * By default development will show errors but testing and live will hide them.
 */

    
switch (ENVIRONMENT)
    {
        case 
'local':
        case 
'dev':
            
error_reporting(E_ALL);
        break;

        case 
'qa':
        case 
'live':
            
error_reporting(0);
        break;

        default:
            exit(
'The application environment is not set correctly.');
    }
    
/*
|---------------------------------------------------------------
| DEFAULT INI SETTINGS
|---------------------------------------------------------------
|
| Hosts have a habbit of setting stupid settings for various
| things. These settings should help provide maximum compatibility
| for PyroCMS
|
*/

    // Let's hold Windows' hand and set a include_path in case it forgot
    
set_include_path(dirname(__FILE__));

    
// Some hosts (was it GoDaddy? complained without this
    
@ini_set('cgi.fix_pathinfo'0);
    
    
// PHP 5.3 will BITCH without this
    
if(ini_get('date.timezone') == '')
    {
        
date_default_timezone_set('GMT');
    }


/*
|---------------------------------------------------------------
| SYSTEM FOLDER NAME
|---------------------------------------------------------------
|
| This variable must contain the name of your "system" folder.
| Include the path if the folder is not in the same  directory
| as this file.
|
| NO TRAILING SLASH!
|
*/
    
$system_path 'system/codeigniter';

/*
 *---------------------------------------------------------------
 * APPLICATION FOLDER NAME
 *---------------------------------------------------------------
 *
 * If you want this front controller to use a different "application"
 * folder then the default one you can set its name here. The folder
 * can also be renamed or relocated anywhere on your server.  If
 * you do, use a full server path. For more info please see the user guide:
 * http://codeigniter.com/user_guide/general/managing_apps.html
 *
 * NO TRAILING SLASH!
 *
 */
    
$application_folder 'system/pyrocms';

/*
 *---------------------------------------------------------------
 * ADDON FOLDER NAME
 *---------------------------------------------------------------
 *
 * If you want this front controller to use a different "application"
 * folder then the default one you can set its name here. The folder
 * can also be renamed or relocated anywhere on your server.  If
 * you do, use a full server path. For more info please see the user guide:
 * http://codeigniter.com/user_guide/general/managing_apps.html
 *
 * NO TRAILING SLASH!
 *
 */
    
$addon_folder 'addons';

/*
 * --------------------------------------------------------------------
 * DEFAULT CONTROLLER
 * --------------------------------------------------------------------
 *
 * Normally you will set your default controller in the routes.php file.
 * You can, however, force a custom routing by hard-coding a 
 * specific controller class/function here.  For most applications, you
 * WILL NOT set your routing here, but it's an option for those 
 * special instances where you might want to override the standard
 * routing in a specific front controller that shares a common CI installation.
 *
 * IMPORTANT:  If you set the routing here, NO OTHER controller will be
 * callable. In essence, this preference limits your application to ONE
 * specific controller.  Leave the function name blank if you need
 * to call functions dynamically via the URI.
 *
 * Un-comment the $routing array below to use this feature
 *
 */
     // The directory name, relative to the "controllers" folder.  Leave blank
     // if your controller is not in a sub-folder within the "controllers" folder
    // $routing['directory'] = '';
    
    // The controller class file name.  Example:  Mycontroller.php
    // $routing['controller'] = '';
    
    // The controller function you wish to be called. 
    // $routing['function']    = '';


/*
 * -------------------------------------------------------------------
 *  CUSTOM CONFIG VALUES
 * -------------------------------------------------------------------
 *
 * The $assign_to_config array below will be passed dynamically to the
 * config class when initialized. This allows you to set custom config 
 * items or override any default config values found in the config.php file.  
 * This can be handy as it permits you to share one application between
 * multiple front controller files, with each file containing different 
 * config values.
 *
 * Un-comment the $assign_to_config array below to use this feature
 *
 */
    // $assign_to_config['name_of_config_item'] = 'value of config item';

// --------------------------------------------------------------------
// END OF USER CONFIGURABLE SETTINGS.  DO NOT EDIT BELOW THIS LINE
// --------------------------------------------------------------------




/*
 * ---------------------------------------------------------------
 *  Resolve the system path for increased reliability
 * ---------------------------------------------------------------
 */
    
if (function_exists('realpath') AND @realpath($system_path) !== FALSE)
    {
        
$system_path realpath($system_path).'/';
    }
    
    
// ensure there's a trailing slash
    
$system_path rtrim($system_path'/').'/';

    
// Is the sytsem path correct?
    
if ( ! is_dir($system_path))
    {
        exit(
"Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__PATHINFO_BASENAME));
    }

/*
 * -------------------------------------------------------------------
 *  Now that we know the path, set the main path constants
 * -------------------------------------------------------------------
 */        
    // The name of THIS file
    
define('SELF'pathinfo(__FILE__PATHINFO_BASENAME));

    
// The PHP file extension
    
define('EXT''.php');

     
// Path to the system folder
    
define('BASEPATH'str_replace("\\""/"$system_path));

     
// Path to the system folder
    
define('ADDONPATH'$addon_folder.'/');
        
    
// Path to the front controller (this file)
    
define('FCPATH'str_replace(SELF''__FILE__));
    
    
// Name of the "system folder"
    
define('SYSDIR'end(explode('/'trim(BASEPATH'/'))));        


    
// The path to the "application" folder
//    if (is_dir($application_folder))
//    {
        
define('APPPATH'$application_folder.'/');
//    }
//    else
//    {
//        if ( ! is_dir(BASEPATH.$application_folder.'/'))
//        {
//            exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
//        }
//
//        define('APPPATH', BASEPATH.$application_folder.'/');
//    }

/*
 * --------------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------------
 *
 * And away we go...
 *
 */
require_once BASEPATH.'core/CodeIgniter'.EXT;

/* End of file index.php */
/* Location: ./index.php */ 
Reply

#8
Most recent Notes: System Folder is $system_path = 'system/codeigniter';
$application_folder = 'system/pyrocms';
$addon_folder = 'addons';


\public_html\system\codeigniter:
folders: core; database; fonts; helpers;language; libraries; .htaccess file (just says deny from all) and index.html (directory access is forbidden)

These are the cleanest folders I've seen.
Inside core folder: Benchmark.php;Codeigniter.php;Common.php;Config.php;Controllers.php;Exceptions.php;Hooks.php;index.html;Input.php;Lang.php;Loader.php;Model.php;Output.php;Router.php;URI.php;Utf8.php


\public_html\system\pyrocms:
Has 18 folders; assets; cache; cache_client; config; controllers; core; errors; helpers; hooks; language; libraries; logs; migrations; modules; plugins; themes; views; widgets;
and index.html that is blank


public_html\system\pyrocms\controllers

only 3 controllers - all lower case admin.php; ajax.php; upgrade.php

public_html\system\pyrocms\config\routes.php

config folder has 25 files and there is no pages controller in controllers folder


$route['default_controller'] = 'pages';
$route['404_override'] = 'pages';

$route['admin/help/([a-zA-Z_-]+)'] = 'admin/help/$1';
$route['admin/([a-zA-Z_-]+)/(:any)'] = '$1/admin/$2';
$route['admin/(login|logout)'] = 'admin/$1';
$route['admin/([a-zA-Z_-]+)'] = '$1/admin/index';

$route['register'] = 'users/register';

$route['user/([\w]+)'] = 'users/profile/view/$1';
$route['my-profile'] = 'users/profile/in
Reply

#9
Sounds correct to me. The framework itself are in system/codeigniter, normally named system.
And the application are in system/pyrocms, normally named application.

So maybe you can ignore/remove everything else... But if that's the main index.php file I do not know. Do a search in all your files for $system_path and see if they have selected a different folder.
Reply

#10
Thanks for getting back to me. I'm not sure if there is a better way to send things The only other place I see it identified is the subfolder
public_html\dox\index.php: $system_path = 'system';

We previously had this setup up:
Production: https:\\falconcredi...com/dox
Development: https:\\client.falconcredit...com/dox

There were many duplicates for production but client.falcon only showed up in a few spots.

H:\public_html\system\pyrocms - has default controller from client.falco config.php
H:public_html\client\index.php
$system_folder = "system";
$application_folder = "application";BASEPATH.'codeigniter/CodeIgniter'.EXT;

homedir\public_html\clear.php:
only locations for client.falconcredi

public_html\client\system\application\config\config.php:

$config['base_url'] = "https://client.falconcredit.com/";


public_html\system\pyrocms\config\database.php:
62 // Live
63 switch($_SERVER['HTTP_HOST']) {
64: case 'client.falconcre.com':
65 $db['live']['hostname'] = 'localhost';
66 $db['live']['username'] = 'falconcr_clientn';

public_html\system\pyrocms\config\pyrocache.php:
4
5 switch($_SERVER['HTTP_HOST']) {
6: case 'client.falconcreditm.com':
7 $config['cache_dir'] = APPPATH.'cache_client/';
8 break;

H:\public_html\client\
\public_html\index.php:
System Folder is $system_path = 'system/codeigniter';
$application_folder = 'system/pyrocms';
$addon_folder = 'addons';
$system_path = 'system/codeigniter';
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.