Commit 928ea38a5e853c6a22e441fc69d6e052c36788e4
1 parent
2c238f04
(#2990) added method to check if the website is in use.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2719 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
19 additions
and
0 deletions
lib/web/WebSite.inc
| ... | ... | @@ -252,6 +252,25 @@ class WebSite { |
| 252 | 252 | $_SESSION["errorMessage"] = $lang_err_database; |
| 253 | 253 | return false; |
| 254 | 254 | } |
| 255 | + | |
| 256 | + /** | |
| 257 | + * Returns true if the website is currently in use- ie. a document is being published to it | |
| 258 | + */ | |
| 259 | + function inUse() { | |
| 260 | + global $default; | |
| 261 | + $sql = $default->db; | |
| 262 | + $sQuery = "SELECT WS.id FROM $default->web_sites_table WS " . | |
| 263 | + "INNER JOIN $default->web_documents_table WD ON WS.id=WD.web_site_id " . | |
| 264 | + "WHERE WS.id = $this->iId " . | |
| 265 | + "AND WD.status_id=1"; | |
| 266 | + $sql->query($sQuery); | |
| 267 | + $rows = $sql->num_rows(); | |
| 268 | + if ($rows > 0){ | |
| 269 | + return true; | |
| 270 | + } else { | |
| 271 | + return false; | |
| 272 | + } | |
| 273 | + } | |
| 255 | 274 | } |
| 256 | 275 | |
| 257 | 276 | /** | ... | ... |