echo "<hr />"; writeLine("<h1>Step 2: Checking API and SECRET Keys.</h1>"); require_once 'ringside/social/config/RingsideSocialConfig.php'; $api_key = RingsideSocialConfig::$apiKey; $secret_key = RingsideSocialConfig::$secretKey; if ($api_key == "RingsideSocial" || $secret_key == "RingsideSocial" || strlen($secret_key) < 4) { writeError(' You have not configured the SOCIAL to API layer appropriately, API KEY and SECRET KEY should be set.'); writeLink("drop.php", "Drop Schema, Start Again"); return; } writeLine(" The keys are configured properly."); echo "<hr />"; writeLine("<h1>Step 3: Let's check your database.</h1>"); $database = RingsideApiDbDatabase::getDatabaseConnection(); if ($database === false) { if (createSchema() === false) { writeLine("Could not create core schema, exiting due to error above."); writeLink("drop.php", "Drop Schema, Start Again"); return; } if (createDemoSchema() === false) { writeLine("Could not create demo schema, exiting due to error above."); writeLink("drop.php", "Drop Schema, Start Again"); return; } } writeLine("We were able to verify the database and schema exists."); echo "<hr />"; writeLine("<h1>Step 4: Check connection to API server.</h1>"); require_once 'ringside/api/clients/RingsideApiClientsConfig.php'; $serverUrl = RingsideApiClientsConfig::$serverUrl;
// Include ding autoloader. \Ding\Autoloader\Autoloader::register(); // Call autoloader register for ding autoloader. // Uncomment these two lines if you want to try zend_cache instead of // the default available cache backends. Also, modify one of the 'impl' options // below to use it (see example below). //require_once 'Zend/Loader/Autoloader.php'; //Zend_Loader_Autoloader::getInstance(); use Ding\Container\Impl\ContainerImpl; use Doctrine\ORM\EntityManager; try { $myProperties = array('doctrine.proxy.dir' => './proxies', 'doctrine.proxy.autogenerate' => true, 'doctrine.proxy.namespace' => "\\Test\\Proxies", 'doctrine.entity.path' => __DIR__ . "/entities", 'doctrine.db.driver' => "pdo_sqlite", 'doctrine.db.path' => __DIR__ . "/db.sqlite3", 'user.name' => 'nobody', 'log.dir' => '/tmp/alogdir', 'log.file' => 'alog.log', 'php.date.timezone' => 'America/Buenos_Aires'); $dingProperties = array('ding' => array('log4php.properties' => __DIR__ . '/../log4php.properties', 'factory' => array('bdef' => array('xml' => array('filename' => 'beans.xml', 'directories' => array(__DIR__))), 'properties' => $myProperties), 'cache' => array('proxy' => array('impl' => 'dummy', 'directories' => '/tmp/Ding/proxy'), 'bdef' => array('impl' => 'dummy', 'directories' => '/tmp/Ding/bdef'), 'beans' => array('impl' => 'dummy')))); $a = ContainerImpl::getInstance($dingProperties); $em = $a->getBean('repository-locator'); createSchema($myProperties); $person = new Person('foobar', 'Foo', 'Bar'); echo "Persisting {$person}\n"; $em->persist($person); $em->flush(); $person = $em->find('Person', 1); echo "Retrieved from db:{$person}\n"; @unlink($myProperties['doctrine.db.path']); } catch (Exception $exception) { echo $exception . "\n"; } function createSchema($props) { $schema = file_get_contents(__DIR__ . '/schema.sql'); $config = new \Doctrine\DBAL\Configuration(); //..
echo "Failed to connect to MySQL: " . mysqli_connect_error() . "\n"; return; } // set database for use for table creation $sql = "USE " . DB_DATABASE; if (!mysqli_query($con, $sql)) { dbErrorMsg("Error selecting datbase" . DB_DATABASE . mysqli_error($con)); return; } db_createOutreachTable($con); db_createProfilesTable($con); db_createTeamsTable($con); db_createUsersVsTeamsTable($con); db_createEmailsVsUsersTable($con); db_createMediaTable($con); db_createHourCountingTable($con); db_createTimesVsOutreachTable($con); db_createUsersVsOutreachTable($con); db_createNotificationsTable($con); db_createOutreachTagsTable($con); db_createTagsVsOutreachTable($con); db_createPermissionsTable($con); db_createPermissionsVsRolesTable($con); db_createUsersVsRolesTable($con); db_createRolesTable($con); db_createOldHoursVsTeamsTable($con); // finally close the connection mysqli_close($con); } createSchema();