Current time: 04-24-2014, 05:50 AM Hello There, Guest! (LoginRegister)


 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Forum Sandbox
06-27-2010, 10:53 PM
Post: #21
RE: Forum Sandbox
(06-27-2010 07:00 PM)shawn16 Wrote:  Where is it? >.>

Everything you need to do is listed in my tutorial.
Visit this user's website Find all posts by this user
06-28-2010, 05:26 AM (This post was last modified: 06-28-2010 06:01 AM by darkly.)
Post: #22
RE: Forum Sandbox
(06-27-2010 05:57 PM)mark-in-dallas Wrote:  
(06-24-2010 05:47 AM)darkly Wrote:  You should work on a script to auto reinstall the forum. Wink

(06-24-2010 06:01 AM)Modv2 Wrote:  I'm terrible at php. Toungue


No php experinece required. I'll give you what you need!

To start with you will need to export a copy of your database as a sql file. If you have cPanel, Plesk or any other Control Panel, go into it and go into phpMyAdmin, click on your myBB database on the left hand side to open the databse, then at the top click on the Export Tab, select all tables and scroll down towards the bottom and check the Save As File checkbox, name it now go over to the right and click Go, select where you want to download the file to and name it "db_refresh.sql". There's your database backup!

Now you'll need to create a file called db_refresh.php and copy and paste the code below into it, changing the database connection information to your database username, database name, pssword and editing the $site line for your URL:

Code:
<?php

    $db_host = 'localhost (Or THE DATABASE ACCESS IF DIFFERENT)';
    $db_user= 'YOUR USERNAME';
    $db_pass = 'YOUR PASSWORD';
    $db_name = 'YOUR DATABASE NAME';
    
    $site = 'http:/YOUR WEBSITE ADDRESS/';

    $dbh=mysql_connect ($db_host, $db_user, $db_pass) or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ($db_name);

    $sqlfile = "db_refresh.sql";
    $fp = fopen($sqlfile, "rb");
    $buffer = fread($fp, filesize($sqlfile));
    fclose($fp);
    $lines = preg_split("/;/", $buffer);

    foreach ($lines as $line_num => $line) {
        echo $line  . "<br>";
        $result = mysql_query ($line)OR die(mysql_error());
    }
?>

Now you'll place the exported sql file and the ds_refresh file somewhere on your server, in the same folder or directory. You can create a new folder if you want too.

And finally, we will setup a cron job to restore the database at whatever interval you want.

Go back into your Control Panel and find Cron Jobs, open it up and create the Cron Job as follows. In the text box for the Command enter this

php -q /home/YOUR DOMAIN USERNAME/public_html/FOLDER YOU PLACED THE FILES IN/db_refresh.php

Now just select the interval you want to restore our sandbox site and wholla, the forum is back to it's original state on every run of the cron job.

You've given myBB members something great to test plugins and code on, so I'm giving you an easy way to restore it to back to the original. Big Grin


OMG!

This is what I'm looking for! Toungue

Edit:

I got this error. Sad

PHP Code:
-- phpMyAdmin SQL Dump -- version 3.2.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jun 27, 2010 at 11:50 PM -- Server version: 5.0.90 -- PHP Version: 5.2.6 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */
/*!40101 SET NAMES utf8 */
-- -- Database: `darkly_mybb14` -- -- -------------------------------------------------------- -- -- Table structure for table `mybb_adminlog` -- CREATE TABLE IF NOT EXISTS `mybb_adminlog` ( `uidint(10unsigned NOT NULL default '0', `ipaddressvarchar(50NOT NULL default '', `datelinebigint(30NOT NULL default '0', `modulevarchar(50NOT NULL default '', `actionvarchar(50NOT NULL default '', `datatext NOT NULLKEY `module` (`module`,`action`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8
-- -- Dumping data for table `mybb_adminlog` -- -- -------------------------------------------------------- -- -- Table structure for table `mybb_adminoptions` -- CREATE TABLE IF NOT EXISTS `mybb_adminoptions` ( `uidint(10NOT NULL default '0', `cpstylevarchar(50NOT NULL default '', `codepressint(1NOT NULL default '1', `notestext NOT NULL, `permissionstext NOT NULL, `defaultviewstext NOT NULLPRIMARY KEY (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8
-- -- Dumping data for table `mybb_adminoptions` -- INSERT INTO `mybb_adminoptions` (`uid`, `cpstyle`, `codepress`, `notes`, `permissions`, `defaultviews`) VALUES (0''1'''a:5:{s:6:"config"
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''a:5:{s:6:"config"' 
at line 6 
Find all posts by this user
06-28-2010, 05:42 AM
Post: #23
RE: Forum Sandbox
Glad you could be helped. Toungue

Common Webmaster Mistakes
OpenNotion - Open-Source Idea Collaboration Software
Visit this user's website Find all posts by this user
06-29-2010, 04:48 PM
Post: #24
RE: Forum Sandbox
Attach or PM me your sql and db_refresh files

(06-28-2010 05:26 AM)darkly Wrote:  OMG!

This is what I'm looking for! Toungue

Edit:

I got this error. Sad

PHP Code:
-- phpMyAdmin SQL Dump -- version 3.2.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jun 27, 2010 at 11:50 PM -- Server version: 5.0.90 -- PHP Version: 5.2.6 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */
/*!40101 SET NAMES utf8 */
-- -- Database: `darkly_mybb14` -- -- -------------------------------------------------------- -- -- Table structure for table `mybb_adminlog` -- CREATE TABLE IF NOT EXISTS `mybb_adminlog` ( `uidint(10unsigned NOT NULL default '0', `ipaddressvarchar(50NOT NULL default '', `datelinebigint(30NOT NULL default '0', `modulevarchar(50NOT NULL default '', `actionvarchar(50NOT NULL default '', `datatext NOT NULLKEY `module` (`module`,`action`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8
-- -- Dumping data for table `mybb_adminlog` -- -- -------------------------------------------------------- -- -- Table structure for table `mybb_adminoptions` -- CREATE TABLE IF NOT EXISTS `mybb_adminoptions` ( `uidint(10NOT NULL default '0', `cpstylevarchar(50NOT NULL default '', `codepressint(1NOT NULL default '1', `notestext NOT NULL, `permissionstext NOT NULL, `defaultviewstext NOT NULLPRIMARY KEY (`uid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8
-- -- Dumping data for table `mybb_adminoptions` -- INSERT INTO `mybb_adminoptions` (`uid`, `cpstyle`, `codepress`, `notes`, `permissions`, `defaultviews`) VALUES (0''1'''a:5:{s:6:"config"
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''a:5:{s:6:"config"' 
at line 6 
Visit this user's website Find all posts by this user
06-29-2010, 06:58 PM (This post was last modified: 06-29-2010 06:59 PM by Tom K..)
Post: #25
RE: Forum Sandbox
The problem is, any fields (such as pm views etc) with ";" in the middle of a line breaks the SQL Smile
Also you'll want to run a script to delete all the files then unzip a fresh backup Smile

Quote:Golf and alcohol don't mix, that's why I don't drink and drive!
Video Tutorials: Installing MyBB | Upgrading MyBB
Visit this user's website Find all posts by this user
06-30-2010, 06:29 AM
Post: #26
RE: Forum Sandbox
(06-29-2010 06:58 PM)Tommyk Wrote:  Also you'll want to run a script to delete all the files then unzip a fresh backup Smile

How do I do that? Toungue
Find all posts by this user
06-30-2010, 07:42 AM
Post: #27
RE: Forum Sandbox
You should buy a domain called theforumsandbox.info and have a list of software people can test that resets itself in 12 hours. Both free and paid software testing. Toungue
Visit this user's website Find all posts by this user
06-30-2010, 08:26 AM
Post: #28
RE: Forum Sandbox
Haha, that'd be a nice idea. I could get Smf and Phpbb too. And, if everyone donated maybe someday IPB and/or VBulletin. Wink

Thanks for the awesome idea. I may actually do that. Toungue

Common Webmaster Mistakes
OpenNotion - Open-Source Idea Collaboration Software
Visit this user's website Find all posts by this user
06-30-2010, 08:34 AM
Post: #29
RE: Forum Sandbox
Already made it Wink

http://www.forumscommunity.com

Register and click "Create".
Visit this user's website Find all posts by this user


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication