本文整理汇总了PHP中Profile::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::delete方法的具体用法?PHP Profile::delete怎么用?PHP Profile::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: realpath
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
$shortoptions = 'y';
$longoptions = array('yes');
$helptext = <<<END_OF_HELP
clean_profiles.php [options]
Deletes all profile table entries where the profile does not occur in the
notice table, is not a group and is not a local user. Very MySQL specific I think.
WARNING: This has not been tested thoroughly. Maybe we've missed a table to compare somewhere.
-y --yes do not wait for confirmation
END_OF_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (!have_option('y', 'yes')) {
print "About to delete profiles that we think are useless to save. Are you sure? [y/N] ";
$response = fgets(STDIN);
if (strtolower(trim($response)) != 'y') {
print "Aborting.\n";
exit(0);
}
}
print "Deleting";
$profile = new Profile();
$profile->query('SELECT * FROM profile WHERE ' . 'NOT (SELECT COUNT(*) FROM notice WHERE profile_id=profile.id) ' . 'AND NOT (SELECT COUNT(*) FROM user WHERE user.id=profile.id) ' . 'AND NOT (SELECT COUNT(*) FROM user_group WHERE user_group.profile_id=profile.id) ' . 'AND NOT (SELECT COUNT(*) FROM subscription WHERE subscriber=profile.id OR subscribed=profile.id) ');
while ($profile->fetch()) {
echo ' ' . $profile->getID() . ':' . $profile->getNickname();
$profile->delete();
}
print "\nDONE.\n";
示例2: connectToEncryptedMySQL
<?php
/**
* Created by PhpStorm.
* User: OldManVin
* Date: 1/22/2016
* Time: 12:01 PM
*/
require_once "/etc/apache2/capstone-mysql/encrypted -config.php";
$pdo = connectToEncryptedMySQL("/ect/apache2/data-design/dfontaine1/ini");
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
require_once "your-class-file.php";
//now use the PDO object normally
$tweet = new Profile(null, 1, "this is from php");
$tweet->insert($pdo);
$tweet->setProfile("now i change the message");
$tweet->update($pdo);
$tweet->delete($pdo);
示例3: testDeleteValidProfile
/**
* test creating a Profile and then deleting it
**/
public function testDeleteValidProfile()
{
// count the number of rows and save it for later
$numRows = $this->getConnection()->getRowCount("profile");
// create a new Profile and insert to into mySQL
$profile = new Profile(null, $this->VALID_ATHANDLE, $this->VALID_EMAIL, $this->VALID_PHONE);
$profile->insert($this->getPDO());
// delete the Profile from mySQL
$this->assertSame($numRows + 1, $this->getConnection()->getRowCount("profile"));
$profile->delete($this->getPDO());
// grab the data from mySQL and enforce the Profile does not exist
$pdoProfile = Profile::getProfileByProfileId($this->getPDO(), $profile->getProfileId());
$this->assertNull($pdoProfile);
$this->assertSame($numRows, $this->getConnection()->getRowCount("profile"));
}
示例4: connectToEncryptedMySQL
<?php
require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
require_once "profile.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/vhooker.ini");
$profile = new Profile(null, 1, "this is from PHP");
$profile->insert($pdo);
$profile->setProfile("now I changed the message");
$profile->update($pdo);
$profile->delete($pdo);
示例5: Profile
*/
include '../inc/includes.php';
Session::checkRight("profile", READ);
if (!isset($_GET['id'])) {
$_GET['id'] = "";
}
$prof = new Profile();
if (isset($_POST["add"])) {
$prof->check(-1, CREATE, $_POST);
$ID = $prof->add($_POST);
// We need to redirect to form to enter rights
Html::redirect($CFG_GLPI["root_doc"] . "/front/profile.form.php?id={$ID}");
} else {
if (isset($_POST["purge"])) {
$prof->check($_POST['id'], PURGE);
if ($prof->delete($_POST, 1)) {
$prof->redirectToList();
} else {
Html::back();
}
} else {
if (isset($_POST["update"]) || isset($_POST["interface"])) {
$prof->check($_POST['id'], UPDATE);
$prof->update($_POST);
Html::back();
}
}
}
Html::header(Profile::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "admin", "profile");
$prof->display(array('id' => $_GET["id"]));
Html::footer();
示例6: Profile
*/
include '../inc/includes.php';
Session::checkRight("profile", "r");
if (!isset($_GET['id'])) {
$_GET['id'] = "";
}
$prof = new Profile();
if (isset($_POST["add"])) {
$prof->check(-1, 'w', $_POST);
$ID = $prof->add($_POST);
// We need to redirect to form to enter rights
Html::redirect($CFG_GLPI["root_doc"] . "/front/profile.form.php?id={$ID}");
} else {
if (isset($_POST["delete"])) {
$prof->check($_POST['id'], 'd');
if ($prof->delete($_POST)) {
$prof->redirectToList();
} else {
Html::back();
}
} else {
if (isset($_POST["update"]) || isset($_POST["interface"])) {
$prof->check($_POST['id'], 'w');
$prof->update($_POST);
Html::back();
}
}
}
Html::header(Profile::getTypeName(2), $_SERVER['PHP_SELF'], "admin", "profile");
$prof->showForm($_GET["id"]);
Html::footer();
示例7: Profile
// Original Author of file: Julien Dombre
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
checkRight("profile", "r");
if (!isset($_GET['id'])) {
$_GET['id'] = "";
}
$prof = new Profile();
if (isset($_POST["add"])) {
$prof->check(-1, 'w', $_POST);
$ID = $prof->add($_POST);
// We need to redirect to form to enter rights
glpi_header($CFG_GLPI["root_doc"] . "/front/profile.form.php?id={$ID}");
} else {
if (isset($_POST["delete"])) {
$prof->check($_POST['id'], 'w');
$prof->delete($_POST);
$prof->redirectToList();
} else {
if (isset($_POST["update"]) || isset($_POST["interface"])) {
$prof->check($_POST['id'], 'w');
$prof->update($_POST);
glpi_header($_SERVER['HTTP_REFERER']);
}
}
}
commonHeader($LANG['Menu'][35], $_SERVER['PHP_SELF'], "admin", "profile");
$prof->showForm($_GET["id"]);
commonFooter();