aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-12-26 03:49:50 -0800
committerfriendica <info@friendica.com>2012-12-26 03:49:50 -0800
commitc8292b3cddf0a29236cb981111beb4587d7be411 (patch)
treed9e5ed5afbf5ca90d04325c70949ea436a40c578
parent1aeea64311d1ae104b8fe513bf13c6f7eeb4fa42 (diff)
downloadvolse-hubzilla-c8292b3cddf0a29236cb981111beb4587d7be411.tar.gz
volse-hubzilla-c8292b3cddf0a29236cb981111beb4587d7be411.tar.bz2
volse-hubzilla-c8292b3cddf0a29236cb981111beb4587d7be411.zip
remove the private keywords stuff to reduce directory and search complexity
-rw-r--r--boot.php8
-rw-r--r--include/profile_advanced.php2
-rw-r--r--install/database.sql7
-rw-r--r--install/update.php10
-rw-r--r--mod/directory.php2
-rw-r--r--mod/hcard.php2
-rw-r--r--mod/match.php6
-rw-r--r--mod/msearch.php6
-rw-r--r--mod/profiles.php18
-rw-r--r--view/tpl/profile_advanced.tpl6
-rw-r--r--view/tpl/profile_edit.tpl9
11 files changed, 34 insertions, 42 deletions
diff --git a/boot.php b/boot.php
index d85309634..bc5c19dc1 100644
--- a/boot.php
+++ b/boot.php
@@ -16,9 +16,9 @@ require_once('include/features.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1008 );
+define ( 'DB_UPDATE_VERSION', 1009 );
-define ( 'EOL', "<br />\r\n" );
+define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -1261,11 +1261,11 @@ function profile_load(&$a, $nickname, $profile = 0) {
// fetch user tags if this isn't the default profile
if(! $r[0]['is_default']) {
- $x = q("select `pub_keywords` from `profile` where uid = %d and `is_default` = 1 limit 1",
+ $x = q("select `keywords` from `profile` where uid = %d and `is_default` = 1 limit 1",
intval($profile_uid)
);
if($x && count($x))
- $r[0]['pub_keywords'] = $x[0]['pub_keywords'];
+ $r[0]['keywords'] = $x[0]['keywords'];
}
$a->profile = $r[0];
diff --git a/include/profile_advanced.php b/include/profile_advanced.php
index 8dfb1beec..749c79a3b 100644
--- a/include/profile_advanced.php
+++ b/include/profile_advanced.php
@@ -49,7 +49,7 @@ function advanced_profile(&$a) {
if($a->profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) );
- if($a->profile['pub_keywords']) $profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']);
+ if($a->profile['keywords']) $profile['keywords'] = array( t('Tags:'), $a->profile['keywords']);
if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']);
diff --git a/install/database.sql b/install/database.sql
index 5581a27c6..990399bc4 100644
--- a/install/database.sql
+++ b/install/database.sql
@@ -654,8 +654,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`sexual` char(255) NOT NULL,
`politic` char(255) NOT NULL,
`religion` char(255) NOT NULL,
- `pub_keywords` text NOT NULL,
- `prv_keywords` text NOT NULL,
+ `keywords` text NOT NULL,
`likes` text NOT NULL,
`dislikes` text NOT NULL,
`about` text NOT NULL,
@@ -687,9 +686,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
KEY `hide_friends` (`hide_friends`),
KEY `postal_code` (`postal_code`),
KEY `country_name` (`country_name`),
- KEY `profile_guid` (`profile_guid`),
- FULLTEXT KEY `pub_keywords` (`pub_keywords`),
- FULLTEXT KEY `prv_keywords` (`prv_keywords`)
+ KEY `profile_guid` (`profile_guid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `profile_check` (
diff --git a/install/update.php b/install/update.php
index bdd687fb3..144a972f9 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1008 );
+define( 'UPDATE_VERSION' , 1009 );
/**
*
@@ -152,3 +152,11 @@ function update_r1007() {
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
+
+function update_r1008() {
+ $r = q("alter table profile drop prv_keywords, CHANGE `pub_keywords` `keywords` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, drop index pub_keywords");
+
+ if($r)
+ return UPDATE_SUCCESS;
+ return UPDATE_FAILED;
+}
diff --git a/mod/directory.php b/mod/directory.php
index b320839a7..2ab1db108 100644
--- a/mod/directory.php
+++ b/mod/directory.php
@@ -65,7 +65,7 @@ $localdir = true;
if($localdir) {
if($search)
$search = dbesc($search);
- $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, channel.channel_address, `pdesc`, `locality`,`region`,`country_name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`pub_keywords`,`prv_keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
+ $sql_extra = ((strlen($search)) ? " AND MATCH (`profile`.`name`, channel.channel_address, `pdesc`, `locality`,`region`,`country_name`,`gender`,`marital`,`sexual`,`about`,`romance`,`work`,`education`,`keywords` ) AGAINST ('$search' IN BOOLEAN MODE) " : "");
$r = q("SELECT COUNT(channel_id) AS `total` FROM channel left join profile on channel.channel_id = profile.uid WHERE `is_default` = 1 and not ( channel_pageflags & %d ) $sql_extra ",
diff --git a/mod/hcard.php b/mod/hcard.php
index 7a2c81c13..cc6d326b5 100644
--- a/mod/hcard.php
+++ b/mod/hcard.php
@@ -31,7 +31,7 @@ function hcard_init(&$a) {
}
if(! $blocked) {
- $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
+ $keywords = ((x($a->profile,'keywords')) ? $a->profile['keywords'] : '');
$keywords = str_replace(array(',',' ',',,'),array(' ',',',','),$keywords);
if(strlen($keywords))
$a->page['htmlhead'] .= '<meta name="keywords" content="' . $keywords . '" />' . "\r\n" ;
diff --git a/mod/match.php b/mod/match.php
index b845b0d46..32d92cdf3 100644
--- a/mod/match.php
+++ b/mod/match.php
@@ -11,19 +11,19 @@ function match_content(&$a) {
$o .= '<h2>' . t('Profile Match') . '</h2>';
- $r = q("SELECT `pub_keywords`, `prv_keywords` FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1",
+ $r = q("SELECT `keywords` FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1",
intval(local_user())
);
if(! count($r))
return;
- if(! $r[0]['pub_keywords'] && (! $r[0]['prv_keywords'])) {
+ if(! $r[0]['keywords']) {
notice( t('No keywords to match. Please add keywords to your default profile.') . EOL);
return;
}
$params = array();
- $tags = trim($r[0]['pub_keywords'] . ' ' . $r[0]['prv_keywords']);
+ $tags = trim($r[0]['keywords'];
if($tags) {
$params['s'] = $tags;
diff --git a/mod/msearch.php b/mod/msearch.php
index 9d587d1e4..b51c4e097 100644
--- a/mod/msearch.php
+++ b/mod/msearch.php
@@ -10,13 +10,13 @@ function msearch_post(&$a) {
if(! strlen($search))
killme();
- $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ",
+ $r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `keywords` AGAINST ('%s') ",
dbesc($search)
);
if(count($r))
$total = $r[0]['total'];
- $r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ",
+ $r = q("SELECT `keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is_default` = 1 AND `user`.`hidewall` = 0 AND MATCH `keywords` AGAINST ('%s') LIMIT %d , %d ",
dbesc($search),
intval($startrec),
intval($perpage)
@@ -29,7 +29,7 @@ function msearch_post(&$a) {
'name' => $rr['name'],
'url' => $a->get_baseurl() . '/channel/' . $rr['nickname'],
'photo' => $a->get_baseurl() . '/photo/avatar/' . $rr['uid'],
- 'tags' => str_replace(array(',',' '),array(' ',' '),$rr['pub_keywords'])
+ 'tags' => str_replace(array(',',' '),array(' ',' '),$rr['keywords'])
);
}
diff --git a/mod/profiles.php b/mod/profiles.php
index c828941b6..37be9bd08 100644
--- a/mod/profiles.php
+++ b/mod/profiles.php
@@ -61,8 +61,7 @@ function profiles_post(&$a) {
$region = notags(trim($_POST['region']));
$postal_code = notags(trim($_POST['postal_code']));
$country_name = notags(trim($_POST['country_name']));
- $pub_keywords = notags(trim($_POST['pub_keywords']));
- $prv_keywords = notags(trim($_POST['prv_keywords']));
+ $keywords = notags(trim($_POST['keywords']));
$marital = notags(trim($_POST['marital']));
$howlong = notags(trim($_POST['howlong']));
$sexual = notags(trim($_POST['sexual']));
@@ -232,8 +231,7 @@ function profiles_post(&$a) {
`hometown` = '%s',
`politic` = '%s',
`religion` = '%s',
- `pub_keywords` = '%s',
- `prv_keywords` = '%s',
+ `keywords` = '%s',
`likes` = '%s',
`dislikes` = '%s',
`about` = '%s',
@@ -266,8 +264,7 @@ function profiles_post(&$a) {
dbesc($hometown),
dbesc($politic),
dbesc($religion),
- dbesc($pub_keywords),
- dbesc($prv_keywords),
+ dbesc($keywords),
dbesc($likes),
dbesc($dislikes),
dbesc($about),
@@ -511,13 +508,11 @@ function profiles_content(&$a) {
'$lbl_hometown' => t('Hometown:'),
'$lbl_politic' => t('Political Views:'),
'$lbl_religion' => t('Religious Views:'),
- '$lbl_pubkey' => t('Public Keywords:'),
- '$lbl_prvkey' => t('Private Keywords:'),
+ '$lbl_pubkey' => t('Keywords:'),
'$lbl_likes' => t('Likes:'),
'$lbl_dislikes' => t('Dislikes:'),
'$lbl_ex2' => t('Example: fishing photography software'),
- '$lbl_pubdsc' => t("\x28Used for suggesting potential friends, can be seen by others\x29"),
- '$lbl_prvdsc' => t("\x28Used for searching profiles, never shown to others\x29"),
+ '$lbl_pubdsc' => t("Used in directory listings"),
'$lbl_about' => t('Tell us about yourself...'),
'$lbl_hobbies' => t('Hobbies/Interests'),
'$lbl_social' => t('Contact information and Social Networks'),
@@ -553,8 +548,7 @@ function profiles_content(&$a) {
'$hometown' => $r[0]['hometown'],
'$politic' => $r[0]['politic'],
'$religion' => $r[0]['religion'],
- '$pub_keywords' => $r[0]['pub_keywords'],
- '$prv_keywords' => $r[0]['prv_keywords'],
+ '$keywords' => $r[0]['keywords'],
'$likes' => $r[0]['likes'],
'$dislikes' => $r[0]['dislikes'],
'$music' => $r[0]['music'],
diff --git a/view/tpl/profile_advanced.tpl b/view/tpl/profile_advanced.tpl
index b02b7f27d..0bc4d3fd3 100644
--- a/view/tpl/profile_advanced.tpl
+++ b/view/tpl/profile_advanced.tpl
@@ -40,10 +40,10 @@
</dl>
{{ endif }}
-{{ if $profile.pub_keywords }}
+{{ if $profile.keywords }}
<dl id="aprofile-tags" class="aprofile">
- <dt>$profile.pub_keywords.0</dt>
- <dd>$profile.pub_keywords.1</dd>
+ <dt>$profile.keywords.0</dt>
+ <dd>$profile.keywords.1</dd>
</dl>
{{ endif }}
diff --git a/view/tpl/profile_edit.tpl b/view/tpl/profile_edit.tpl
index eb0bb1eed..a0ab681fb 100644
--- a/view/tpl/profile_edit.tpl
+++ b/view/tpl/profile_edit.tpl
@@ -143,17 +143,10 @@ $sexual
<div id="profile-edit-pubkeywords-wrapper" >
<label id="profile-edit-pubkeywords-label" for="profile-edit-pubkeywords" >$lbl_pubkey </label>
-<input type="text" size="32" name="pub_keywords" id="profile-edit-pubkeywords" title="$lbl_ex2" value="$pub_keywords" />
+<input type="text" size="32" name="keywords" id="profile-edit-pubkeywords" title="$lbl_ex2" value="$keywords" />
</div><div id="profile-edit-pubkeywords-desc">$lbl_pubdsc</div>
<div id="profile-edit-pubkeywords-end"></div>
-<div id="profile-edit-prvkeywords-wrapper" >
-<label id="profile-edit-prvkeywords-label" for="profile-edit-prvkeywords" >$lbl_prvkey </label>
-<input type="text" size="32" name="prv_keywords" id="profile-edit-prvkeywords" title="$lbl_ex2" value="$prv_keywords" />
-</div><div id="profile-edit-prvkeywords-desc">$lbl_prvdsc</div>
-<div id="profile-edit-prvkeywords-end"></div>
-
-
<div class="profile-edit-submit-wrapper" >
<input type="submit" name="submit" class="profile-edit-submit-button" value="$submit" />
</div>